mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Reports\ControllersLogic;
|
|
|
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
|
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
|
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
|
use Maatwebsite\Excel\Concerns\WithMapping;
|
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
|
|
|
class ExportExcelLogic implements FromCollection, ShouldAutoSize, WithHeadings, WithColumnFormatting, WithMapping
|
|
{
|
|
private $data;
|
|
|
|
public function __construct($data)
|
|
{
|
|
$this->data=$data;
|
|
}
|
|
public function collection()
|
|
{
|
|
return $this->data;
|
|
}
|
|
public function map($order): array
|
|
{
|
|
return [
|
|
(string)$order->reference,
|
|
(string)$order->container_number,
|
|
(string)$order->fulladdress,
|
|
(string)$order->created_at,
|
|
"ssxxx"
|
|
];
|
|
}
|
|
|
|
public function columnFormats(): array
|
|
{
|
|
return [
|
|
'A'=>'@',
|
|
'B' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
|
|
];
|
|
}
|
|
|
|
public function headings(): array
|
|
{
|
|
return ["Reference", "Container", "Address", "Created", "Status"];
|
|
}
|
|
|
|
}
|