mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:54:05 +00:00
Fix redirect macro test
This commit is contained in:
parent
75f00a58dd
commit
665d222872
4 changed files with 11 additions and 8 deletions
|
|
@ -71,7 +71,7 @@ return [
|
||||||
// Their responsibility is making Laravel features tenant-aware.
|
// Their responsibility is making Laravel features tenant-aware.
|
||||||
'database' => 'Stancl\Tenancy\TenancyBootstrappers\DatabaseTenancyBootstrapper',
|
'database' => 'Stancl\Tenancy\TenancyBootstrappers\DatabaseTenancyBootstrapper',
|
||||||
'cache' => 'Stancl\Tenancy\TenancyBootstrappers\CacheTenancyBootstrapper',
|
'cache' => 'Stancl\Tenancy\TenancyBootstrappers\CacheTenancyBootstrapper',
|
||||||
'filesystem' => 'Stancl\Tenancy\TenancyBootstrappers\FilesystemTenancyBootstrapper',
|
// 'filesystem' => 'Stancl\Tenancy\TenancyBootstrappers\FilesystemTenancyBootstrapper',
|
||||||
'redis' => 'Stancl\Tenancy\TenancyBootstrappers\RedisTenancyBootstrapper',
|
'redis' => 'Stancl\Tenancy\TenancyBootstrappers\RedisTenancyBootstrapper',
|
||||||
'queue' => 'Stancl\Tenancy\TenancyBootstrappers\QueueTenancyBootstrapper',
|
'queue' => 'Stancl\Tenancy\TenancyBootstrappers\QueueTenancyBootstrapper',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,12 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
||||||
'path' => $this->app->storagePath(),
|
'path' => $this->app->storagePath(),
|
||||||
'asset_url' => $this->app['config']['app.asset_url'],
|
'asset_url' => $this->app['config']['app.asset_url'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$this->app['url']->macro('setAssetRoot', function ($root) {
|
||||||
|
$this->assetRoot = $root;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function start(Tenant $tenant)
|
public function start(Tenant $tenant)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ namespace Stancl\Tenancy;
|
||||||
use Illuminate\Cache\CacheManager;
|
use Illuminate\Cache\CacheManager;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Stancl\Tenancy\TenancyBootstrappers\FilesystemTenancyBootstrapper;
|
||||||
|
|
||||||
class TenancyServiceProvider extends ServiceProvider
|
class TenancyServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|
@ -40,11 +41,9 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
\Stancl\Tenancy\Middleware\InitializeTenancy::class,
|
\Stancl\Tenancy\Middleware\InitializeTenancy::class,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->app->instance('globalUrl', clone $this->app['url']);
|
$this->app->singleton('globalUrl', function ($app) {
|
||||||
$this->app['url']->macro('setAssetRoot', function ($root) {
|
$instance = clone $app['url'];
|
||||||
$this->assetRoot = $root;
|
$instance->setAssetRoot($app[FilesystemTenancyBootstrapper::class]->originalPaths['asset_url']);
|
||||||
|
|
||||||
return $this;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
// if app.asset_url is set, suffix it
|
|
||||||
// if it's not set, use this controller?
|
|
||||||
Route::get('/tenancy/assets/{path}', 'Stancl\Tenancy\Controllers\TenantAssetsController@asset')
|
Route::get('/tenancy/assets/{path}', 'Stancl\Tenancy\Controllers\TenantAssetsController@asset')
|
||||||
->where('path', '(.*)')
|
->where('path', '(.*)')
|
||||||
->name('stancl.tenancy.asset');
|
->name('stancl.tenancy.asset');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue