26 lines
830 B
PHP
26 lines
830 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Client;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ReportResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'status' => $this->status,
|
|
'submitted_at' => $this->submitted_at ? verta($this->submitted_at)->format('%Y/%m/%d - H:i') : null,
|
|
'document' => $this->whenLoaded('document', fn () => [
|
|
'id' => $this->document->id,
|
|
'code' => $this->document->code,
|
|
'modality' => $this->document->modality,
|
|
'status' => $this->document->status,
|
|
]),
|
|
'doctor' => $this->whenLoaded('doctor', fn () => optional($this->doctor)->fullname),
|
|
];
|
|
}
|
|
}
|