selectedCompanyId(auth()->user()); $this->activeCompany = $companyId === null ? 'all' : (string) $companyId; } public function updatedActiveCompany(CustomerCompanyContext $context): void { if ($this->activeCompany === 'all') { $context->select(auth()->user(), null); } elseif (is_numeric($this->activeCompany)) { $context->select(auth()->user(), (int) $this->activeCompany); } $this->redirect($this->redirectTarget(), navigate: false); } public function with(CustomerCompanyContext $context): array { $user = auth()->user(); return [ 'companies' => $context->companiesFor($user), 'selectedCompany' => $context->selectedCompany($user), 'context' => $context, 'user' => $user, ]; } private function redirectTarget(): string { return (string) request()->headers->get('referer', route('me.dashboard')); } }; ?>
@if ($companies->isNotEmpty())
@foreach ($companies as $company) @endforeach
@if ($selectedCompany) {{ __('Firma öffnen') }} @else {{ __('Firmen') }} @endif @else {{ __('Keine Firma zugeordnet') }} @endif