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\Inspection;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class InspectionsExport implements FromCollection, WithHeadings
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Inspection::select([
|
||||
'id',
|
||||
'project_id',
|
||||
'feature_id',
|
||||
'template_id',
|
||||
'status',
|
||||
'notes',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
])->get();
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'ID Proyecto',
|
||||
'ID Característica',
|
||||
'ID Plantilla',
|
||||
'Estado',
|
||||
'Notas',
|
||||
'Creado el',
|
||||
'Actualizado el'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user