first commit
This commit is contained in:
29
app/Exports/PermohonanExport.php
Normal file
29
app/Exports/PermohonanExport.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user