From 51228defc68a6362e31f486a04e3117105abf3e0 Mon Sep 17 00:00:00 2001 From: Vincent GS Date: Thu, 26 May 2022 04:51:27 -0500 Subject: [PATCH] [3.x][Filesystem] Provide an additional argument for tenant name path (#817) * 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 * Missing missing updates Moving from $subject to $root when %storage_path% has been replaced --- src/Bootstrappers/FilesystemTenancyBootstrapper.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Bootstrappers/FilesystemTenancyBootstrapper.php b/src/Bootstrappers/FilesystemTenancyBootstrapper.php index da1e5e2af..346892b35 100644 --- a/src/Bootstrappers/FilesystemTenancyBootstrapper.php +++ b/src/Bootstrappers/FilesystemTenancyBootstrapper.php @@ -5,7 +5,6 @@ namespace Stancl\Tenancy\Bootstrappers; use Illuminate\Contracts\Foundation\Application; -use Illuminate\Filesystem\FilesystemAdapter; use Illuminate\Support\Facades\Storage; use Stancl\Tenancy\Contracts\TenancyBootstrapper; use Stancl\Tenancy\Contracts\Tenant; @@ -61,8 +60,8 @@ public function bootstrap(Tenant $tenant) $this->originalPaths['disks'][$disk] = $originalRoot; $finalPrefix = str_replace( - '%storage_path%', - storage_path(), + ['%storage_path%', '%tenant%'], + [storage_path(), $tenant->getTenantKey()], $this->app['config']["tenancy.filesystem.root_override.{$disk}"] ?? '', );