initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class WashResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'trigger_method' => $this->trigger_method,
|
||||
'status' => $this->status,
|
||||
'program' => $this->program,
|
||||
'started_at' => $this->started_at?->toIso8601String(),
|
||||
'ended_at' => $this->ended_at?->toIso8601String(),
|
||||
'duration_minutes' => $this->duration_minutes,
|
||||
'cost' => (float) $this->cost,
|
||||
'created_at' => $this->created_at?->toIso8601String(),
|
||||
'machine' => new MachineResource($this->whenLoaded('machine')),
|
||||
'booking' => new BookingResource($this->whenLoaded('booking')),
|
||||
'user' => new UserResource($this->whenLoaded('user')),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user