25 lines
769 B
PHP
25 lines
769 B
PHP
<?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')),
|
|
];
|
|
}
|
|
}
|