From a2c8218e6a08a46f99dce9bbe4a18073d937bd42 Mon Sep 17 00:00:00 2001 From: Vincent GS Date: Fri, 4 Mar 2022 02:01:51 -0600 Subject: [PATCH] Let the user pass the tenant suffix by %tenant% In this PR we let the user pass an additional parameter using `%tenant%` so the user can additionally pass the folder corresponding to each tenant. This is my proposal, because if I try to use %storage_path% within Linux, I get the full path to the project when I use Google Cloud Storage --- src/Bootstrappers/FilesystemTenancyBootstrapper.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bootstrappers/FilesystemTenancyBootstrapper.php b/src/Bootstrappers/FilesystemTenancyBootstrapper.php index d5ae2d50..b1d0b147 100644 --- a/src/Bootstrappers/FilesystemTenancyBootstrapper.php +++ b/src/Bootstrappers/FilesystemTenancyBootstrapper.php @@ -58,12 +58,14 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper /** @var FilesystemAdapter $filesystemDisk */ $filesystemDisk = Storage::disk($disk); $this->originalPaths['disks'][$disk] = $filesystemDisk->getAdapter()->getPathPrefix(); + $subject = $this->app['config']["tenancy.filesystem.root_override.{$disk}"] ?? ''; if ($root = str_replace( '%storage_path%', storage_path(), - $this->app['config']["tenancy.filesystem.root_override.{$disk}"] ?? '' + $subject )) { + $root = str_replace('%tenant%', $suffix, $subject); $filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root); } else { $root = $this->app['config']["filesystems.disks.{$disk}.root"];