feat: Add Excel export functionality for reports (projects, phases, inspections) using maatwebsite/excel
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Project;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class ProjectsExport implements FromCollection, WithHeadings
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Project::select([
|
||||
'id',
|
||||
'name',
|
||||
'description',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
])->get();
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Nombre',
|
||||
'Descripción',
|
||||
'Fecha de inicio',
|
||||
'Fecha de fin',
|
||||
'Estado',
|
||||
'Creado el',
|
||||
'Actualizado el'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user