File manager - Edit - /var/www/html/spdc/api/app/Http/Resources/ScheduleResource.php
Back
<?php namespace App\Http\Resources; use App\Models\User; use Illuminate\Http\Resources\Json\JsonResource; class ScheduleResource extends JsonResource { /** * Transform the resource into an array. * * @param \Illuminate\Http\Request $request * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ public function toArray($request) { return [ 'id' => $this->id, 'type' => $this->type, 'date' => now()->parse($this->date)->format('Y-m-d'), 'exit_time' => now()->parse($this->exit_time)->format('H:i'), 'driver_id' => $this->driver_id, 'driver' => new UserResource(User::find($this->driver_id)), 'note' => $this->note, 'emergency' => $this->emergency, 'transportation_id' => $this->transportation_id, 'transportation' => new TransportationResource($this->transportation), 'occurrencies' => OccurrencyResource::collection($this->whenLoaded('occurrencies')), 'extra' => new ExtraScheduleResource($this->whenLoaded('extra')), 'agents' => ScheduleAgentResource::collection($this->agents), 'request' => new ScheduleRequestResource($this->whenLoaded('request')), 'bdt' => new BDTResource($this->whenLoaded('bdt')), 'supplies' => TransportationSupplyResource::collection($this->whenLoaded('supplies')), ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings