country = request()->route('country', config('app.domain_country')); } public function filterByType(?string $type): void { $this->typeFilter = $this->typeFilter === $type ? null : $type; $this->resetPage(); } public function with(): array { return [ 'services' => SelfHostedService::query() ->with('createdBy') ->when($this->search, fn($q) => $q->where('name', 'ilike', '%'.$this->search.'%')) ->when($this->typeFilter, fn($q) => $q->where('type', $this->typeFilter)) ->orderBy('name') ->paginate(15), 'types' => \App\Enums\SelfHostedServiceType::cases(), ]; } }; ?>