feat(custom-field): tambahkan fitur custom field

- Menambahkan model CustomField dengan atribut mass assignable.
- Membuat request validation untuk custom field.
- Menambahkan route dan breadcrumb untuk custom field.
- Membuat migration untuk tabel custom_fields.
- Menambahkan export functionality untuk custom field.
- Membuat view untuk menambah dan mengedit custom field.
This commit is contained in:
Daeng Deni Mardaeni
2025-01-30 15:54:52 +07:00
parent a43c65e4c2
commit 32de93ef9f
10 changed files with 542 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace Modules\Lpj\Exports;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Modules\Lpj\Models\CustomField;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
class CustomFieldExport implements WithColumnFormatting, WithHeadings, FromCollection, WithMapping
{
public function collection()
{
return CustomField::all();
}
public function map($row): array
{
return [
$row->id,
$row->name,
$row->type,
$row->created_at,
$row->updated_at,
];
}
public function headings(): array
{
return [
'ID',
'Name',
'Type',
'Created At',
'Updated At',
];
}
public function columnFormats(): array
{
return [
'A' => NumberFormat::FORMAT_NUMBER,
'D' => NumberFormat::FORMAT_DATE_DDMMYYYY,
'E' => NumberFormat::FORMAT_DATE_DDMMYYYY,
];
}
}