39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Siswa extends Model
|
|
{
|
|
use HasFactory;
|
|
protected $table = 'tbl_nilai'; // Specify the name of your table if it's different from the convention
|
|
protected $primaryKey = 'id'; // Specify the primary key if it's different from 'id'
|
|
public $incrementing = false; // Set to false if the primary key is not auto-incrementing
|
|
protected $keyType = 'string'; // Set the data type of the primary key if it's not an integer
|
|
public $timestamps = false;
|
|
protected $fillable = [
|
|
'id',
|
|
'id_guru',
|
|
'id_jadwal',
|
|
'id_siswa',
|
|
'nilai',
|
|
];
|
|
|
|
public function wali()
|
|
{
|
|
return $this->hasOne(User::class, 'id', 'id_wali');
|
|
}
|
|
|
|
public function jadwal()
|
|
{
|
|
return $this->hasOne(Jadwal::class, 'id', 'id_jadwal');
|
|
}
|
|
|
|
public function guru()
|
|
{
|
|
return $this->hasOne(User::class, 'id', 'id_guru');
|
|
}
|
|
}
|