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

Fix a lot of bugs, fix #23

This commit is contained in:
Samuel Štancl 2019-02-08 22:44:46 +01:00
parent 39d9c9d51e
commit 22fc843ce3
10 changed files with 88 additions and 23 deletions

View file

@ -4,6 +4,7 @@ namespace Stancl\Tenancy\Traits;
use Stancl\Tenancy\CacheManager;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Storage;
trait BootstrapsTenancy
{
@ -47,20 +48,22 @@ trait BootstrapsTenancy
$suffix = $this->app['config']['tenancy.filesystem.suffix_base'] . tenant('uuid');
// storage_path()
$this->app->useStoragePath($old['storage_path'] . "/{$suffix}");
// Storage facade
foreach ($this->app['config']['tenancy.filesystem.disks'] as $disk) {
$root = $this->app['config']["filesystems.disks.{$disk}.root"];
\Storage::disk($disk)->getAdapter()->setPathPrefix(
$root . "/{$suffix}"
);
if ($root = str_replace('%storage_path%', storage_path(), $this->app['config']["tenancy.filesystem.root_override.{$disk}"])) {
Storage::disk($disk)->getAdapter()->setPathPrefix($root);
} else {
$root = $this->app['config']["filesystems.disks.{$disk}.root"];
Storage::disk($disk)->getAdapter()->setPathPrefix($root . "/{$suffix}");
}
$old['storage_disks'][$disk] = $root;
}
// storage_path()
$this->app->useStoragePath($old['storage_path'] . "/{$suffix}");
$this->oldStoragePaths = $old;
}
}