You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.0 KiB
59 lines
2.0 KiB
<?php
|
|
|
|
namespace App\Exports;
|
|
|
|
use App\Models\ParkingSpace;
|
|
use App\Services\OperationLogService;
|
|
use App\Services\ParkingSpaceService;
|
|
use Maatwebsite\Excel\Concerns\FromArray;
|
|
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
|
|
class ParkingSpaceExport implements FromArray, WithHeadings
|
|
{
|
|
|
|
public function array(): array
|
|
{
|
|
$data = [];
|
|
ParkingSpace::all()->each(
|
|
function ($item) use (&$data) {
|
|
$oldItem = (new ParkingSpaceService(
|
|
new OperationLogService()
|
|
))->optionItems($item);
|
|
$data[] = [
|
|
'id' => $oldItem['id'],
|
|
'floor' => $oldItem['floor'],
|
|
'number' => $oldItem['number'],
|
|
'space_attr' => $oldItem['space_attr'],
|
|
'license_plate' => $oldItem['license_plate'],
|
|
'berthing_time' => $oldItem['berthing_time'],
|
|
'recognition' => $oldItem['recognition'],
|
|
'status' => $oldItem['status'],
|
|
'space_type' => $oldItem['space_type'],
|
|
'operation_type' => $oldItem['operation_type'],
|
|
'updated_at' => $oldItem['updated_at']
|
|
];
|
|
}
|
|
);
|
|
return $data;
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function headings(): array
|
|
{
|
|
return [
|
|
__('exports.global.index'),
|
|
__('exports.parking_space.floor'),
|
|
__('exports.parking_space.number'),
|
|
__('exports.parking_space.space_attr'),
|
|
__('exports.parking_space.license_plate'),
|
|
__('exports.parking_space.berthing_time'),
|
|
__('exports.parking_space.recognition'),
|
|
__('exports.parking_space.status'),
|
|
__('exports.parking_space.space_type'),
|
|
__('exports.parking_space.operation_type'),
|
|
__('exports.parking_space.updated_at')
|
|
];
|
|
}
|
|
}
|
|
|