/** * Show the form for creating a new resource. * * @return \Response */ public function create() { if (auth()->check()) { \Session::reflash(); \Session::flash('info', 'Cannot register when logged in'); return redirect('/'); } return view('register'); }
/** * Show the topic. * * @return Response */ public function getTopic($id) { $topic = Topic::find($id); $tags = $topic->tags()->get(); if (\Session::has('flashTag') && $tags->contains(\Session::get('flashTag'))) { \Session::reflash('flashTag'); $mainTag = \Session::get('flashTag'); } else { $mainTag = $tags->first(); } $posts = $topic->posts()->with(['user', 'likeCounter'])->get(); $firstPost = $posts->shift(); return view('forum.topic')->with(['topic' => $topic, 'tags' => $tags, 'mainTag' => $mainTag, 'firstPost' => $firstPost, 'posts' => $posts]); }