%PDF- %PDF-
Direktori : /var/www/pjc/app/Exports/ |
Current File : /var/www/pjc/app/Exports/UsersExport.php |
<?php namespace App\Exports; use Maatwebsite\Excel\Concerns\FromQuery; use Maatwebsite\Excel\Concerns\Exportable; use App\Scadenziario; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\WithHeadings; use Maatwebsite\Excel\Concerns\WithMapping; use PhpOffice\PhpSpreadsheet\Shared\Date; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; use Maatwebsite\Excel\Concerns\WithColumnFormatting; use Maatwebsite\Excel\Concerns\ShouldAutoSize; use Maatwebsite\Excel\Concerns\WithStyles; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; use Illuminate\Contracts\View\View; use Maatwebsite\Excel\Concerns\FromView; class UsersExport implements FromView { /** * @return \Illuminate\Support\Collection */ use Exportable; public function __construct($data_inizio,String $data_fine,String $cliente) { $this->data_inizio = $data_inizio; $this->data_fine = $data_fine; $this->cliente = $cliente; } public function headings(): array { return [ 'DOCUMENTAZIONE ', 'TEMPI', 'CONFORME', 'NOTE', 'SCADENZA', ]; } public function view(): View { if($this->data_inizio) { if($this->cliente) { return view('scadenziario', [ 'scadenziario' => Scadenziario::where('data_scadenza', '>', $this->data_inizio)->where('data_scadenza', '<', $this->data_fine) ->where('idCliente',$this->cliente)->get(), ]); } else {return view('scadenziario', [ 'scadenziario' => Scadenziario::where('data_scadenza', '>', $this->data_inizio)->where('data_scadenza', '<', $this->data_fine)->get(), ]);} } else { if($this->cliente) { return view('scadenziario', [ 'scadenziario' => Scadenziario::where('idCliente',$this->cliente)->get(), ]); } else { return view('scadenziario', [ 'scadenziario' => Scadenziario::all(), ]); } } } }