<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\User;
use App\Models\Agence;
use App\Models\Report;
use App\Models\Partner;
use App\Models\FinanceSource;
use App\Models\OutageNotificaion;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Equipment extends Model
{
    use HasFactory;

    protected $table      = 'equipment';
    protected $primaryKey = 'equipment_id';
    public $timestamps    = false;


    protected $fillable = [
        'agence_id',
        'user_id',
        'finance_source_id',
        'partner_id',
        'eq_manufacturer',
        'eq_model',
        'eq_serial_number',
        "eq_energy_source",
        'eq_install_year',
        'eq_type',
        'eq_temperature_kit',
        'eq_tension_kit',
        'eq_pqs_certificat',
        'eq_matricule',
        'name_responsable',
        'tel_responsable',
        'immatriculation',
        'eq_status',
        'eq_register_date',
        'offline',
    ];

    protected $hidden = [ ];

    protected $casts = [
        // 'eq_register_date' => 'datetime:d/m/Y',
        'eq_register_date' => 'datetime:Y-m-d',
    ];


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

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

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

    public function EquipmentVaccines()
    {
        return $this->hasMany(EquipmentVaccine::class, 'equipment_id', 'equipment_id');
    }

    public function Reports()
    {
        return $this->hasMany(Report::class, 'equipment_id', 'equipment_id');
    }

    public function Partner()
    {
        return $this->belongsTo(Partner::cl