1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 14:14:04 +00:00

Fix #1404: support universal routes in CheckTenantForMaintenanceMode

This commit also corrects an Event::fake() call in a separate test, as
general Event::fake() calls without specified events can lead to
incorrect (and difficult to debug) behavior in some cases, since
Tenancy depends on the event system being functional.
This commit is contained in:
Samuel Štancl 2025-10-14 17:11:47 +02:00
parent e806825f71
commit e1b8658414
No known key found for this signature in database
GPG key ID: BA146259A1E16C57
2 changed files with 42 additions and 6 deletions

View file

@ -14,7 +14,13 @@ class CheckTenantForMaintenanceMode extends CheckForMaintenanceMode
public function handle($request, Closure $next)
{
if (! tenant()) {
throw new TenancyNotInitializedException;
// If there's no tenant, there's no tenant to check for maintenance mode.
// Since tenant identification middleware has higher priority than this
// middleware, a missing tenant would have already lead to request termination.
// (And even if priority were misconfigured, the request would simply get
// terminated *after* this middleware.)
// Therefore, we are likely on a universal route, in central context.
return $next($request);
}
if (tenant('maintenance_mode')) {