public function secondsago($type) { if (Log::where('case_type', $type)->exists()) { $now = Carbon::now(); $last = Log::LatestLog($type); $lastLog = new Carbon($last); return $now->diffInSeconds($lastLog); } return false; }