QueenFruits/Backend/app/Http/Resources/StaffResource.php

30 lines
1.0 KiB
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class StaffResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'uuid' => $this->uuid,
'outlet_id' => $this->outlet?->uuid,
'name' => $this->name,
'email' => $this->email,
'phone_number' => $this->phone_number,
'role' => $this->role,
'place_of_birth' => $this->place_of_birth,
'date_of_birth' => $this->date_of_birth,
'shift_name' => $this->shift_name,
'shift_start_time' => $this->shift_start_time,
'shift_end_time' => $this->shift_end_time,
'is_active' => (bool) $this->is_active,
'created_at' => $this->created_at?->toIso8601String(),
'updated_at' => $this->updated_at?->toIso8601String(),
];
}
}