/** * Displays the specified service status. * * @param int|string $id * * @return \Illuminate\View\View */ public function status($id) { $service = $this->service->with('records')->findOrFail($id); $current = $service->last_record; if ($current instanceof ServiceRecord) { // Remove the last record out of the records collection. $service->records->shift(); } return view('pages.services.status', compact('service', 'current')); }