<?php namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class Guardian extends Model {

    protected $fillable = ['cin','password','first_name','last_name',' date_birth' ,'mobile'];

    public function getDates(){
        return['created_at' , 'updated_at' , 'date_birth'];
    }

    public function logs(){
        return $this->hasMany('App\Models\Log');
    }
    public function scopeTokenValid()
    {
        return !Carbon::createFromTimeStamp(strtotime($this->expires_on))->isPast();
    }
}
