complete Complete User Request Submission section RAD-1
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Admin;
|
||||
|
||||
use Hekmatinasser\Verta\Verta;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ReportResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'document' => $this->relationLoaded('document') ? $this->document->only(['id','code']) : null,
|
||||
'status' => $this->status,
|
||||
'body' => $this->body,
|
||||
'doctor' => $this->relationLoaded('doctor') ? $this->doctor->only(['id','fullname']) : null,
|
||||
'submitted_at' => verta($this->submitted_at)->format('%Y/%m/%d - H:i'),
|
||||
'submitted_at_form' => $this->submitted_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user