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

34 lines
1008 B
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,
'remarks' => $this->remarks,
'check_status' => $this->check_status,
'check_status_text' => $this->check_status?->text(),
'sort' => $this->sort,
'check' => WorkflowCheckResource::make($this->whenLoaded('check')),
];
}
}