From b6b0173ae4a5a664e9ae8590beca27ac10132ceb Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Fri, 27 Jun 2025 13:18:57 +0800 Subject: [PATCH] =?UTF-8?q?Room=20=E6=99=82=E9=96=93=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=8C=AF=E8=AA=A4=2020250627?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Room.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Models/Room.php b/app/Models/Room.php index ac1cab5..3e583a6 100644 --- a/app/Models/Room.php +++ b/app/Models/Room.php @@ -80,4 +80,18 @@ class Room extends Model public function statusLogs() { return $this->hasMany(RoomStatusLog::class); } + public function toArray() + { + $array = parent::toArray(); + + if ($this->started_at) { + $array['started_at'] = $this->started_at->timezone('Asia/Taipei')->format('Y-m-d H:i:s'); + } + + if ($this->ended_at) { + $array['ended_at'] = $this->ended_at->timezone('Asia/Taipei')->format('Y-m-d H:i:s'); + } + + return $array; + } }