resetPage(); } public function updatedPortalFilter(): void { $this->resetPage(); } public function updatedStatusFilter(): void { $this->resetPage(); } public function toggleActive(int $id): void { $footerCode = FooterCode::query()->find($id); if (! $footerCode) { return; } $footerCode->update(['is_active' => ! $footerCode->is_active]); } public function with(): array { $term = trim($this->search); $codes = FooterCode::query() ->withCount('categories') ->when($this->portalFilter !== 'all', fn ($q) => $q->where('portal', $this->portalFilter)) ->when($this->statusFilter === 'active', fn ($q) => $q->where('is_active', true)) ->when($this->statusFilter === 'inactive', fn ($q) => $q->where('is_active', false)) ->when($this->statusFilter === 'global', fn ($q) => $q->where('is_global', true)) ->when(filled($term), function ($q) use ($term): void { $q->where(function ($q) use ($term): void { $q->where('title', 'like', '%'.$term.'%') ->orWhere('content', 'like', '%'.$term.'%'); }); }) ->orderByDesc('is_global') ->orderBy('priority') ->orderBy('title') ->paginate(25); return [ 'codes' => $codes, 'portalOptions' => Portal::cases(), 'totals' => [ 'total' => FooterCode::query()->count(), 'active' => FooterCode::query()->where('is_active', true)->count(), 'global' => FooterCode::query()->where('is_global', true)->count(), ], ]; } }; ?>
{{ __('Snippets, die unter Pressemitteilungen ausgespielt werden.') }}