<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\Country;
use App\Models\Vaccine;
use App\Models\Vaccination;
use App\Models\PatientVaccine;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Patient extends Model
{
    use HasFactory;

    protected $table      = 'patients';
    protected $primaryKey = 'patient_id';
    public $timestamps = false;
    
    protected $fillable = [
        'country_id',
        'pat_lastname',
        'pat_firstname',
        "pat_name",
        'pat_gender',
        'pat_date_birth',
        'pat_place_birth',
        'pat_phone',
        'pat_town',
        'pat_destination',
        'pat_last_vaccine',
        "pat_matricule",
        'pat_reg_date',
    ];

    protected $hidden = [ ];

    protected $casts = [
        'pat_reg_date' => 'datetime',
    ];


    public function Vaccines(){
        return $this->belongsToMany(Vaccine::class, "patient_vaccines", 'patient_id', 'vaccine_id')
        ->withPivot([
            'patient_vaccine_id',
            'patient_id',
            'vaccine_id',
            'stock_id',
            "user_id",
            'pav_vaccine_date',
            'pav_status',
            'pav_reg_date'
        ]);
    }

    public function Country()
    {
        return $this->