generated from liutk/owl-admin-base
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class OvertimeApplyResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
|
|
'employee_id' => $this->employee_id,
|
|
'employee' => EmployeeResource::make($this->whenLoaded('employee')),
|
|
'store_id' => $this->store_id,
|
|
'store' => StoreResource::make($this->whenLoaded('store')),
|
|
|
|
'workflow_check' => WorkflowCheckResource::make($this->whenLoaded('workflow')),
|
|
|
|
'date' => $this->date->timestamp,
|
|
'date_format' => $this->date->format('Y-m-d'),
|
|
'start_at' => $this->start_at->timestamp,
|
|
'start_format' => $this->start_at->format('H:i'),
|
|
'end_at' => $this->end_at->timestamp,
|
|
'end_format' => $this->end_at->format('H:i'),
|
|
'hours' => $this->hours,
|
|
|
|
'reason' => $this->reason,
|
|
'created_at' => $this->created_at->timestamp,
|
|
'created_format' => $this->created_at->format('Y-m-d H:i:s'),
|
|
];
|
|
}
|
|
}
|