Esempio n. 1
0
 public function reply(HttpRequest $request, $id)
 {
     $topic = Topic::findOrFail($id);
     $this->authorizePost($topic->forum, $topic);
     $this->validate($request, ['body' => 'required']);
     if ($topic->addPost(Auth::user(), Request::input('body'), false)) {
         $posts = Post::where('post_id', $topic->topic_last_post_id)->get();
         $postsPosition = $topic->postsPosition($posts);
         Event::fire(new TopicWasReplied($topic, $posts->last(), Auth::user()));
         return view('forum.topics._posts', compact('posts', 'postsPosition', 'topic'));
     }
 }
Esempio n. 2
0
 public function reply(HttpRequest $request, $id)
 {
     $topic = Topic::findOrFail($id);
     $this->authorizePost($topic->forum, $topic);
     $this->validate($request, ["body" => "required"]);
     if ($topic->addPost(Auth::user(), Request::input("body"), false)) {
         $posts = Post::where("post_id", $topic->topic_last_post_id)->get();
         $postsPosition = $topic->postsPosition($posts);
         Event::fire(new TopicWasReplied($topic, $posts->last(), Auth::user()));
         return view("forum.topics._posts", compact("posts", "postsPosition", "topic"));
     }
 }