<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\Exports;

use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithColumnWidths;

class FinesExport implements FromCollection, WithHeadings, WithMapping,WithColumnWidths
{   /**
    * @return \Illuminate\Support\Collection
    */
    protected $fines;
    protected $key = 0;
    public function __construct($fines)
    {
        $this->fines = $fines;
    }

    public function collection()
    {
        return $this->fines;
    }

    public function headings(): array
    {
        return [
            'No',
            'Infraction',
            'Plaque',
            'Proprietaire',
            'No_Telephone',
            'Date_Limite',
            'Agent',
            'Date_register',
            'Montant',
        ];
    }

    public function map($value): array
    {
        $this->key++;
        return [
            $this->key,
            isset($value->infraction) ? $value->infraction->inf_name : "",
            isset($value->engin) ? $value->engin->ud_no_plaque : null,
            isset( $value->engin) && isset( $value->engin->user) ?  $value->engin->user->usr_name : "",
            isset( $value->engin) && isset( $value->engin->user) ?  $value->engin->user->usr_phone : "",
            isset($value->admin) ? $value->admin->ad_name : "",
            $value->am_date_limite,
            $value->am_date,
            isset($value->infraction) ? $value->infraction->