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

36 lines
1.1 KiB
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class WorkflowLogResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'check_id' => $this->check_id,
'batch_id' => $this->batch_id,
'check_type' => $this->check_type,
'check_value' => $this->check_type,
'check_name' => $this->check_name,
'check_user_id' => $this->check_user_id,
'checked_at' => $this->checked_at?->timestamp,
'checked_format' => $this->checked_at?->format('Y-m-d H:i:s'),
'remarks' => $this->remarks,
'check_status' => $this->check_status,
'check_status_text' => $this->check_status->text(),
'sort' => $this->sort,
'check' => WorkflowCheckResource::make($this->whenLoaded('check')),
'check_user' => EmployeeResource::make($this->whenLoaded('checkUser')),
];
}
}