<?php

namespace App\Models;

use App\Models\BaseModel;

class ParentModel extends BaseModel
{
    protected $table = 'parents';

    // CI model didn't specify timestamps
    public $timestamps = true;

    protected $fillable = [
        'secondparent_firstname',
        'secondparent_lastname',
        'secondparent_gender',
        'secondparent_email',
        'secondparent_phone',
        'firstparent_id',
        'secondparent_id',
        'semester',
        'school_year',
        'created_at',
        'updated_at',
    ];

    protected $casts = [
        'firstparent_id' => 'integer',
    ];

    /* Optional relationship */
    public function firstParentUser()
    {
        return $this->belongsTo(User::class, 'firstparent_id');
    }
}