mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
f8230990f4
This reverts merge request !157
32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\Booking;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use App\Http\Resources\V2\BookingV2Resource;
|
|
use App\Http\Resources\V2\CompanyV2Resource;
|
|
|
|
class ListDocumentJobResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'reference' => $this->reference,
|
|
'status' => (int) $this->status,
|
|
'document_type' => $this->document_type,
|
|
'owner' => $this->relationLoaded('owner') ? ($this->owner instanceof Booking ? new BookingV2Resource($this->owner, $this->userInfo) : new CompanyV2Resource($this->owner, $this->userInfo)) : null,
|
|
'files' => FileResource::collection($this->files),
|
|
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y h:i:s A')
|
|
];
|
|
}
|
|
}
|