30 lines
864 B
PHP
30 lines
864 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class RoomResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'branch_id' => $this->branch_id,
|
|
'type' => $this->type,
|
|
'name' => $this->name,
|
|
'floor' => $this->floor,
|
|
'is_online' => $this->is_online,
|
|
'status' => $this->status,
|
|
'started_at' => optional($this->started_at)->timezone('Asia/Taipei')->format('Y-m-d H:i:s'),
|
|
'ended_at' => optional($this->ended_at)->timezone('Asia/Taipei')->format('Y-m-d H:i:s'),
|
|
];
|
|
}
|
|
}
|