mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 11:14:03 +00:00
Filesystem adapter updated
This commit is contained in:
parent
cf7d6eebb6
commit
8445e3ebb8
2 changed files with 11 additions and 14 deletions
|
|
@ -25,6 +25,7 @@ services:
|
|||
stdin_open: true
|
||||
tty: true
|
||||
mysql:
|
||||
platform: linux/x86_64
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
|
|
@ -36,6 +37,7 @@ services:
|
|||
timeout: 10s
|
||||
retries: 10
|
||||
mysql2:
|
||||
platform: linux/x86_64
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
|
|
@ -47,6 +49,7 @@ services:
|
|||
timeout: 10s
|
||||
retries: 10
|
||||
postgres:
|
||||
platform: linux/x86_64
|
||||
image: postgres:11
|
||||
environment:
|
||||
POSTGRES_PASSWORD: password
|
||||
|
|
|
|||
|
|
@ -54,23 +54,20 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
|||
}
|
||||
|
||||
// Storage facade
|
||||
Storage::forgetDisk($this->app['config']['tenancy.filesystem.disks']);
|
||||
foreach ($this->app['config']['tenancy.filesystem.disks'] as $disk) {
|
||||
/** @var FilesystemAdapter $filesystemDisk */
|
||||
$filesystemDisk = Storage::disk($disk);
|
||||
$this->originalPaths['disks'][$disk] = $filesystemDisk->getAdapter()->getPathPrefix();
|
||||
$root = $this->app['config']["filesystems.disks.{$disk}.root"];
|
||||
$this->originalPaths['disks'][$disk] = $root;
|
||||
|
||||
if ($root = str_replace(
|
||||
if (!$root = str_replace(
|
||||
'%storage_path%',
|
||||
storage_path(),
|
||||
$this->app['config']["tenancy.filesystem.root_override.{$disk}"] ?? ''
|
||||
)) {
|
||||
$filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root);
|
||||
} else {
|
||||
$root = $this->app['config']["filesystems.disks.{$disk}.root"];
|
||||
$filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root . "/{$suffix}");
|
||||
$root .= '/' . $suffix;
|
||||
}
|
||||
|
||||
$this->app['config']["filesystems.disks.{$disk}.root"] = $finalPrefix;
|
||||
$this->app['config']["filesystems.disks.{$disk}.root"] = $root;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,13 +81,10 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
|||
$this->app['url']->setAssetRoot($this->app['config']['app.asset_url']);
|
||||
|
||||
// Storage facade
|
||||
|
||||
Storage::forgetDisk($this->app['config']['tenancy.filesystem.disks']);
|
||||
foreach ($this->app['config']['tenancy.filesystem.disks'] as $disk) {
|
||||
/** @var FilesystemAdapter $filesystemDisk */
|
||||
$filesystemDisk = Storage::disk($disk);
|
||||
|
||||
$root = $this->originalPaths['disks'][$disk];
|
||||
|
||||
$filesystemDisk->getAdapter()->setPathPrefix($root);
|
||||
$this->app['config']["filesystems.disks.{$disk}.root"] = $root;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue