where(function ($query) { return $query->where('user_id', Auth::user()->id) ->orWhereIn('user_id', Auth::user()->friends()->lists('id')); })->orderBy('created_at', 'desc')->paginate(20); return view('timeline.index')->with('statuses', $statuses); # Return to the timeline home with the $statues variable } return view('home'); # Return the default view if the user is not logged in } public function guide() { return view('guidelines'); # Return the guidelines view } public function publicHandler() { # If the user requests /public, return home return redirect()->route('home'); } }