store-manage/app/Http/Resources/EmployeeSignRepairResource.php

39 lines
1.2 KiB
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class EmployeeSignRepairResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'date' => $this->date->timestamp,
'date_format' => $this->date->format('Y-m-d H:i'),
'employee_id' => $this->employee_id,
'employee' => EmployeeResource::make($this->whenLoaded('employee')),
'store_id' => $this->store_id,
'store' => StoreResource::make($this->whenLoaded('store')),
'reason' => $this->reason,
'sign_time' => $this->sign_time,
'sign_time_text' => $this->sign_time->text(),
'sign_type' => $this->sign_type,
'outside_remarks' => $this->outside_remarks,
'created_at' => $this->created_at->timestamp,
'created_format' => $this->created_at->format('Y-m-d H:i:s'),
'workflow_check' => WorkflowCheckResource::make($this->whenLoaded('workflow')),
];
}
}