published()->with('category'); if ($request->filled('q')) { $builder->whereFullText(['title', 'excerpt', 'body'], (string) $request->string('q')); } if ($request->filled('difficulty')) { $builder->where('difficulty', (string) $request->string('difficulty')); } return view('public.guides.index', [ 'items' => $builder->latest('published_at')->paginate(15)->withQueryString(), 'categories' => Category::query()->where('type', 'guide')->where('is_active', true)->orderBy('name')->get(), 'filters' => $request->only(['q', 'difficulty']), 'sidebarTools' => Tool::published()->latest('published_at')->limit(6)->get(), 'sidebarModels' => AiModel::published()->orderByDesc('total_score')->limit(6)->get(), ]); } public function byTopic(string $slug, Request $request): View { $request->merge(['difficulty' => $slug]); return $this->index($request); } public function show(string $slug): View { /** @var Guide $guide */ $guide = Guide::query() ->published() ->with('category') ->where('slug', $slug) ->firstOrFail(); return view('public.guides.show', [ 'item' => $guide, 'bodyHtml' => $this->markdownRenderer->render($guide->body), ]); } }