Initial Commit
This commit is contained in:
89
app/Exports/KJPPExport.php
Normal file
89
app/Exports/KJPPExport.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?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\KJPP;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class KJPPExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return KJPP::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->jenis_kantor,
|
||||
$row->nomor_ijin_usaha,
|
||||
$row->province_code,
|
||||
$row->city_code,
|
||||
$row->district_code,
|
||||
$row->village_code,
|
||||
$row->address,
|
||||
$row->postal_code,
|
||||
$row->nomor_telepon_kantor,
|
||||
$row->email_kantor,
|
||||
$row->nama_pimpinan,
|
||||
$row->nomor_hp_pimpinan,
|
||||
$row->nama_pic_reviewer,
|
||||
$row->nomor_hp_pic_reviewer,
|
||||
$row->nama_pic_admin,
|
||||
$row->nomor_hp_pic_admin,
|
||||
$row->nama_pic_marketing,
|
||||
$row->nomor_hp_pic_marketing,
|
||||
$row->ijin_usaha_id,
|
||||
$row->jenis_aset_id,
|
||||
$row->attachment,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Jenis Kantor',
|
||||
'Nomor Ijin Usaha',
|
||||
'Province Code',
|
||||
'City Code',
|
||||
'District Code',
|
||||
'Village Code',
|
||||
'Address',
|
||||
'Postal Code',
|
||||
'Nomor Telepon Kantor',
|
||||
'Email Kantor',
|
||||
'Nama Pimpinan',
|
||||
'Nomor HP Pimpinan',
|
||||
'Nama PIC Reviewer',
|
||||
'Nomor HP PIC Reviewer',
|
||||
'Nama PIC Admin',
|
||||
'Nomor HP PIC Admin',
|
||||
'Nama PIC Marketing',
|
||||
'Nomor HP PIC Marketing',
|
||||
'Ijin Usaha ID',
|
||||
'Jenis Aset ID',
|
||||
'Attachment',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'B' => NumberFormat::FORMAT_NUMBER,
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user