public function show($id) { $post = Post::findorFail($id); /*$comments = Comment::where('post_id', '=', $id)->orderBy('created_at', 'desc')->get(); $count = new Comment(); foreach($comments as $comment) { $count['children'.$comment->id] = $comment->children; $count['parent'.$comment->id] = $comment->parent; }*/ //$count = Post::findorFail($id)->comments; //$count = Comment::findorFail($id)->parent; return view('posts.show', compact('post')); }
public function tweetPost($id) { $post = Post::findorFail($id); event(new PostWasTweeted($post)); return redirect()->route('admin.post.index')->withSuccess('Post was tweeted'); }