48 lines
1.2 KiB
PHP
48 lines
1.2 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_siswa'; // 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_kelas',
|
|
'id_wali',
|
|
'nis',
|
|
'nama',
|
|
'agama',
|
|
'agama_ayah',
|
|
'kota_siswa',
|
|
'alamat',
|
|
'nama_ibu',
|
|
'telepon',
|
|
'pekerjaan_ibu',
|
|
'pekerjaan_ayah',
|
|
'tempat_lahir',
|
|
'nama_ayah',
|
|
'tanggal_lahir',
|
|
'telepon_ortu',
|
|
'agama_ibu',
|
|
'status'
|
|
];
|
|
|
|
public function kelas()
|
|
{
|
|
return $this->hasOne(Kelas::class, 'id', 'id_kelas');
|
|
}
|
|
|
|
public function wali()
|
|
{
|
|
return $this->hasOne(User::class, 'id', 'id_wali');
|
|
}
|
|
}
|