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

29 lines
809 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class ReimbursementResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'type' => KeywordResource::make($this->whenLoaded('type')),
'workflow_check' => WorkflowCheckResource::make($this->whenLoaded('workflow')),
'expense' => $this->expense,
'reason' => $this->reason,
'photos' => $this->photos,
'created_at' => $this->created_at?->getTimestamp(),
'updated_at' => $this->updated_at?->getTimestamp(),
];
}
}