initial commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class MachineResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'uuid' => $this->uuid,
|
||||
'name' => $this->name,
|
||||
'type' => $this->type,
|
||||
'status' => $this->status,
|
||||
'qr_code' => $this->qr_code,
|
||||
'cycle_started_at' => $this->cycle_started_at?->toIso8601String(),
|
||||
'cycle_ends_at' => $this->cycle_ends_at?->toIso8601String(),
|
||||
'last_heartbeat_at' => $this->last_heartbeat_at?->toIso8601String(),
|
||||
'establishment' => new EstablishmentResource($this->whenLoaded('establishment')),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user