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