2025-01-27 22:40:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Forum;
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
2025-02-10 01:58:12 +02:00
|
|
|
use App\Models\Forum\Category;
|
|
|
|
|
use App\Models\Forum\Thread;
|
|
|
|
|
use App\Models\Forum\Topic;
|
2025-01-27 22:40:26 +02:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
|
|
class ThreadsController extends Controller
|
|
|
|
|
{
|
2025-02-10 01:58:12 +02:00
|
|
|
public function show(string $categorySlug, string $threadSlug)
|
2025-02-02 14:23:11 +02:00
|
|
|
{
|
2025-02-10 01:58:12 +02:00
|
|
|
$category = Category::where('slug', $categorySlug)->first();
|
|
|
|
|
$thread = Thread::where('slug', $threadSlug)->first();
|
2025-02-02 14:23:11 +02:00
|
|
|
|
2025-08-16 15:38:07 +03:00
|
|
|
if (!$category || !$thread) {
|
|
|
|
|
abort(404);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$topics = Topic::with('author')
|
|
|
|
|
->where('category_id', $category->id)
|
2025-02-10 01:58:12 +02:00
|
|
|
->where('thread_id', $thread->id)
|
|
|
|
|
->paginate(15);
|
|
|
|
|
|
|
|
|
|
return view('forum.thread', compact('category', 'thread', 'topics'));
|
2025-02-02 14:23:11 +02:00
|
|
|
}
|
2025-01-27 22:40:26 +02:00
|
|
|
}
|