From aee2a2e567b929137d49a18dbb8b23c34d937617 Mon Sep 17 00:00:00 2001 From: Samuel Stancl Date: Tue, 14 Jul 2020 19:51:11 +0200 Subject: [PATCH] Set root in config() too --- src/Bootstrappers/FilesystemTenancyBootstrapper.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Bootstrappers/FilesystemTenancyBootstrapper.php b/src/Bootstrappers/FilesystemTenancyBootstrapper.php index 58dda98c..d161297d 100644 --- a/src/Bootstrappers/FilesystemTenancyBootstrapper.php +++ b/src/Bootstrappers/FilesystemTenancyBootstrapper.php @@ -60,12 +60,13 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper $this->originalPaths['disks'][$disk] = $filesystemDisk->getAdapter()->getPathPrefix(); if ($root = str_replace('%storage_path%', storage_path(), $this->app['config']["tenancy.filesystem.root_override.{$disk}"])) { - $filesystemDisk->getAdapter()->setPathPrefix($root); + $filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root); } else { $root = $this->app['config']["filesystems.disks.{$disk}.root"]; - - $filesystemDisk->getAdapter()->setPathPrefix($root . "/{$suffix}"); + $filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root . "/{$suffix}"); } + + $this->app['config']["filesystems.disks.{$disk}.root"] = $finalPrefix; } } @@ -83,7 +84,10 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper /** @var FilesystemAdapter $filesystemDisk */ $filesystemDisk = Storage::disk($disk); - $filesystemDisk->getAdapter()->setPathPrefix($this->originalPaths['disks'][$disk]); + $root = $this->originalPaths['disks'][$disk]; + + $filesystemDisk->getAdapter()->setPathPrefix($root); + $this->app['config']["filesystems.disks.{$disk}.root"] = $root; } } }