Refactor Administration entrypoint

We moved the administration item to the company switcher in the header
This commit is contained in:
Darko Gjorgjijoski
2026-04-04 01:36:28 +02:00
parent 29b3abd317
commit eb0a588164
17 changed files with 295 additions and 30 deletions

View File

@@ -21,11 +21,15 @@ class CompanyMiddleware
$firstCompany = $user->companies()->first();
// User has no companies — allow request through without company header
// (BootstrapController handles this gracefully)
if (! $firstCompany) {
return $next($request);
}
// Super admin without company header — allow pass-through (admin mode)
if ($user->isSuperAdmin() && ! $request->header('company')) {
return $next($request);
}
if (! $request->header('company') || ! $user->hasCompany($request->header('company'))) {
$request->headers->set('company', $firstCompany->id);
}