this_time)->subMilliseconds($this->diffsecond)->format('Y-m-d H:i:s.u'), 0, -3); } public function getTimeoutAttribute() { // this_time 與現在差超過150秒則回傳1 代表超時 return Carbon::parse($this->this_time)->diffInSeconds() > 150 ? 1 : 0; } // 修改現有的diffsecond格式 public function getDiffsecondAttribute($value) { return floatval($value) * 1000; } }