validate(['q' => ['nullable', 'string', 'max:120'], 'sector' => ['nullable', 'string', 'max:80']]); return Inertia::render('PortalInvestidor', ['initialView' => 'opportunities', 'initialQuery' => $filters['q'] ?? '', 'initialSector' => $filters['sector'] ?? '']); } public function sector(string $slug): Response|RedirectResponse { if (in_array($slug, ['energia', 'fintech'], true)) { return redirect(SectorOrganization::href($slug), 301); } if ($slug === 'mercado-financeiro/fintech') { $slug = 'fintech'; } $sector = Sector::where('slug', $slug)->where('is_active', true)->whereNotNull('published_at')->firstOrFail(); return Inertia::render('portal/services', ['section' => 'sector', ...app(SectorInvestment::class)->page($sector)]); } public function opportunity(string $slug): Response { return $this->detail($slug, 'detail'); } public function interest(?string $slug = null): Response { return $slug ? $this->detail($slug, 'interest') : Inertia::render('PortalInvestidor', ['initialView' => 'interest', 'countries' => app(CountryCatalogue::class)->all()]); } private function detail(string $slug, string $view): Response { $opportunity = Opportunity::with('sector:id,name,slug')->published()->where('slug', $slug)->firstOrFail(); return Inertia::render('PortalInvestidor', ['initialView' => $view, 'initialOpportunity' => $opportunity, 'countries' => app(CountryCatalogue::class)->all()]); } }