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; + } }