public function index() { $posts = Posts::with('comments')->where('active', 1)->orderBy('created_at', 'desc')->paginate(5); if (Auth::check()) { return view('pages.velkommen', array('currentUser' => Auth::user()))->with('posts', $posts); } return view('pages.velkommen')->with('posts', $posts); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { return \App\Posts::with('users')->find($id); }