<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SiswaBadge extends Model
{
    use HasFactory;

    protected $table = 'siswa_badges'; 

    protected $primaryKey = 'id_siswa_badge';

    protected $fillable = [
        'id_siswa',
        'id_badge',
        'tanggal_diberikan',
    ];

    public function siswa()
    {
        return $this->belongsTo(Siswa::class, 'id_siswa', 'id_siswa'); 
    }

    public function badge()
    {
        return $this->belongsTo(Badge::class, 'id_badge', 'id_badge');
    }
}