public function reply($slug) { $thread = Thread::whereSlug($slug)->firstOrFail(); $this->authorize('laraboard::thread-reply', $thread); event(new \Christhompsontldr\Laraboard\Events\ThreadViewed($thread, \Auth::user())); $posts = Post::where('id', $thread->id)->first()->getDescendantsAndSelf()->reverse()->slice(0, 100); return view('laraboard::thread.reply', compact('thread', 'posts')); }
/** * */ public function show($category_slug, $slug) { $board = Board::whereSlug($slug)->firstOrFail(); // @todo figure why can't paginate on getDescendants(); $threads = Post::where('id', $board->id)->first()->getDescendants(); $threads = Thread::whereIn('id', $threads->pluck('id'))->paginate(config('laraboard.thread.limit', 15)); return view('laraboard::board.show', compact('board', 'threads')); }