<br />
<b>Warning</b>:  Undefined variable $auth in <b>/home/pevo0181/public_html/pia-soft.com/cleania/routes/index.php</b> on line <b>542</b><br />
<br />
<b>Warning</b>:  Trying to access array offset on value of type null in <b>/home/pevo0181/public_html/pia-soft.com/cleania/routes/index.php</b> on line <b>542</b><br />
<?php

namespace App\Models;

use App\Models\Card;
use App\Models\User;
use App\Models\Country;
use App\Models\Appointment;
use App\Models\Vaccination;
use App\Models\CardRegenerated;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Patient extends Model
{
    use HasFactory, SoftDeletes;

    protected $table        = 'patients';
    protected $primaryKey   = 'patient_id';

    protected $fillable = [
        "country_id",
        "user_id",
        "pat_lastname",
        "pat_firstname",
        "pat_name",
        "pat_civility",
        "pat_birth_date",
        "pat_birth_place",
        "pat_phone",
        "pat_email",
        "pat_town",
        "pat_address",
        "pat_blood_type",
        "pat_photo",
        "pat_pin_code",
        "pat_matricule",
        "pat_status",
    ];

    const CREATED_AT = 'pat_created_at';
    const UPDATED_AT = 'pat_updated_at';
    const DELETED_AT = 'pat_deleted_at';

    protected $casts = [
        'pat_created_at' => 'datetime:Y-m-d m:i:s',
        'pat_updated_at' => 'datetime:Y-m-d m:i:s',
        'pat_deleted_at' => 'datetime:Y-m-d m:i:s',
    ];


    public function Country()
    {
        return $this->belongsTo(Country::class,'country_id','country_id');
    }

    public function User()
    {
        return $this->belongsTo(User::class, 'user_id', 'user_id');
    }

    public function Vaccinations()
    {
        return $this->hasMany(Vaccination::class, 'patient_id', 'patient_id');
    }

    public function Appointments()
    {
        