<?php

namespace App\Models;

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

use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;

class NilaiSantri extends Model
{
    use HasApiTokens, HasFactory, Notifiable;

    protected $fillable = [
        'santri_id', 'kelas_id', 'mapel_id', 'semester_id', 'tanggal', 'nilai', 'keterangan', 'jenis_nilai'
    ];

    public function santri()
    {
        return $this->belongsTo(User::class, 'santri_id');
    }
    public function kelas()
    {
        return $this->belongsTo(\App\Models\Kelas::class);
    }
    public function mapel()
    {
        return $this->belongsTo(\App\Models\MataPelajaran::class, 'mapel_id');
    }
    public function mataPelajaran()
    {
        return $this->belongsTo(\App\Models\MataPelajaran::class, 'mapel_id');
    }
    public function semester()
    {
        return $this->belongsTo(\App\Models\Semester::class, 'semester_id');
    }
}
