mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 03:04:05 +00:00
Refactor Administration entrypoint
We moved the administration item to the company switcher in the header
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user