예제 #1
0
 /**
  * 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');
 }
예제 #2
0
 /**
  * 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]);
 }