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:
parent
e806825f71
commit
e1b8658414
2 changed files with 42 additions and 6 deletions
|
|
@ -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')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue