Initial Commit

This commit is contained in:
Daeng Deni Mardaeni
2024-08-07 08:47:07 +07:00
commit 225b326a5e
60 changed files with 3408 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
<?php
namespace Modules\Usermanagement\Exports;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use Modules\Usermanagement\Models\User;
class UsersExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
{
public function collection(){
return User::all();
}
public function map($row): array{
return [
$row->id,
$row->name,
$row->email,
$row->created_at
];
}
public function headings(): array{
return [
'ID',
'Name',
'Email',
'Created At'
];
}
public function columnFormats(): array{
return [
'A' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER,
'C' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME
];
}
}