30 lines
779 B
PHP
30 lines
779 B
PHP
<?php
|
|
|
|
namespace App\Exports;
|
|
|
|
use App\Models\Permohonan;
|
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
|
|
class PermohonanExport implements FromCollection, WithHeadings
|
|
{
|
|
public function collection()
|
|
{
|
|
return Permohonan::with(['user', 'jabatan', 'vot'])->get()->map(fn ($p) => [
|
|
$p->no_rujukan,
|
|
$p->user?->name,
|
|
$p->jabatan?->nama,
|
|
$p->vot?->kod,
|
|
$p->kategori,
|
|
$p->status,
|
|
$p->jumlah_keseluruhan,
|
|
optional($p->submitted_at)->format('d/m/Y'),
|
|
]);
|
|
}
|
|
|
|
public function headings(): array
|
|
{
|
|
return ['No Rujukan', 'Pemohon', 'Jabatan', 'VOT', 'Kategori', 'Status', 'Jumlah', 'Tarikh Hantar'];
|
|
}
|
|
}
|