feat(jenis-lampiran): tambahkan fitur jenis lampiran
- Menambahkan model JenisLampiran dengan relasi ke LampiranDokumen. - Membuat migrasi untuk tabel jenis_lampiran. - Menambahkan rute dan kontroler untuk operasi CRUD jenis lampiran. - Menambahkan permintaan validasi untuk jenis lampiran. - Menambahkan tampilan untuk membuat dan mengedit jenis lampiran. - Menambahkan breadcrumb untuk navigasi jenis lampiran. - Menambahkan fitur ekspor data jenis lampiran ke Excel.
This commit is contained in:
46
app/Exports/JenisLampiranExport.php
Normal file
46
app/Exports/JenisLampiranExport.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\app\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use Modules\Lpj\app\Models\JenisLampiran;
|
||||
|
||||
class JenisLampiranExport implements WithColumnFormatting, WithHeadings, FromCollection, WithMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisLampiran::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->nama,
|
||||
$row->deskripsi,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Nama',
|
||||
'Deskripsi',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user