first(); $thread = Thread::where('slug', $threadSlug)->first(); if (!$category || !$thread) { abort(404); } $topics = Topic::with('author') ->where('category_id', $category->id) ->where('thread_id', $thread->id) ->paginate(15); return view('forum.thread', compact('category', 'thread', 'topics')); } }