39 lines
738 B
PHP
39 lines
738 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class StudentParent extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'student_id',
|
|
'relation_type',
|
|
'name',
|
|
'nik',
|
|
'birth_year',
|
|
'education',
|
|
'occupation',
|
|
'phone_number',
|
|
'address',
|
|
'is_alive',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'birth_year' => 'integer',
|
|
'is_alive' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function student(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Student::class);
|
|
}
|
|
}
|