mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:54:03 +00:00
Fix globalUrl binding
This commit is contained in:
parent
eb7680ce67
commit
407eb183b7
1 changed files with 12 additions and 2 deletions
|
|
@ -82,14 +82,24 @@ class TenancyServiceProvider extends ServiceProvider
|
|||
|
||||
$this->app->make(Kernel::class)->prependMiddleware(Middleware\InitializeTenancy::class);
|
||||
|
||||
|
||||
/**
|
||||
* Since tenancy is initialized in the global middleware stack, this
|
||||
* middleware group acts mostly as a 'flag' for the PreventAccess
|
||||
* middleware to decide whether the request should be aborted.
|
||||
*/
|
||||
Route::middlewareGroup('tenancy', [
|
||||
/* Prevent access from tenant domains to central routes and vice versa. */
|
||||
Middleware\PreventAccessFromTenantDomains::class,
|
||||
]);
|
||||
|
||||
$this->app->singleton('globalUrl', function ($app) {
|
||||
$instance = clone $app['url'];
|
||||
$instance->setAssetRoot($app[FilesystemTenancyBootstrapper::class]->originalPaths['asset_url']);
|
||||
if ($app->bound(FilesystemTenancyBootstrapper::class)) {
|
||||
$instance = clone $app['url'];
|
||||
$instance->setAssetRoot($app[FilesystemTenancyBootstrapper::class]->originalPaths['asset_url']);
|
||||
} else {
|
||||
$instance = $app['url'];
|
||||
}
|
||||
|
||||
return $instance;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue