/** * Display the specified resource. * * @param string $user_name - the name of the user * @return Response */ public function show($user_name) { try { $user = \Nexus\User::with('comments', 'comments.author')->where('username', $user_name)->firstOrFail(); } catch (ModelNotFoundException $ex) { $message = "{$user_name} not found. Maybe you're thinking of someone else"; \Nexus\Helpers\FlashHelper::showAlert($message, 'warning'); return redirect('/users/'); } if ($user->id === \Auth::user()->id) { \Auth::user()->markCommentsAsRead(); \Auth::user()->save(); } \Nexus\Helpers\ActivityHelper::updateActivity(\Auth::user()->id, "Examining <em>{$user->username}</em>", action('Nexus\\UserController@show', ['user_name' => $user_name])); $breadcrumbs = \Nexus\Helpers\BreadcrumbHelper::breadcrumbForUser($user); return view('users.show', compact('user', 'breadcrumbs')); }