Files
2025-08-16 15:38:07 +03:00

30 lines
776 B
PHP

<?php
namespace App\Http\Controllers\Forum;
use App\Http\Controllers\Controller;
use App\Models\Forum\Category;
use App\Models\Forum\Thread;
use App\Models\Forum\Topic;
use Illuminate\Http\Request;
class ThreadsController extends Controller
{
public function show(string $categorySlug, string $threadSlug)
{
$category = Category::where('slug', $categorySlug)->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'));
}
}