<?php

namespace App\Models;

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

class Leaderboard extends Model
{
    use HasFactory;

    protected $table = 'leaderboards'; 

    protected $primaryKey = 'id_history';

    protected $fillable = [
        'id_siswa',
        'id_kelas',
        'total_exp',
        'ranking',
        'semester',
        'tahun_ajaran',
        'tanggal_snapshot',
    ];
    
    public function siswa()
    {
        return $this->belongsTo(Siswa::class, 'id_siswa', 'id_siswa'); 
    }

    public function kelas()
    {
        return $this->belongsTo(Kelas::class, 'id_kelas', 'id_kelas');
    }
}