From 3ec4314e91385b59bfd0632721a29d71ce1cbc72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sun, 27 Oct 2019 21:49:28 +0100 Subject: [PATCH] [2.2.0] Optional storage path suffixing (#197) * Optional storage path suffixing * Default value true --- assets/config.php | 1 + src/TenancyBootstrappers/FilesystemTenancyBootstrapper.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/config.php b/assets/config.php index 4b0aa810..d5989b33 100644 --- a/assets/config.php +++ b/assets/config.php @@ -42,6 +42,7 @@ return [ ], 'filesystem' => [ // https://tenancy.samuelstancl.me/docs/v2/filesystem-tenancy/ 'suffix_base' => 'tenant', + 'suffix_storage_path' => true, // Note: Disabling this will likely break local disk tenancy. Only disable this if you're using an external file storage service like S3. // Disks which should be suffixed with the suffix_base + tenant id. 'disks' => [ 'local', diff --git a/src/TenancyBootstrappers/FilesystemTenancyBootstrapper.php b/src/TenancyBootstrappers/FilesystemTenancyBootstrapper.php index b08a79e2..5d417f8b 100644 --- a/src/TenancyBootstrappers/FilesystemTenancyBootstrapper.php +++ b/src/TenancyBootstrappers/FilesystemTenancyBootstrapper.php @@ -38,7 +38,9 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper $suffix = $this->app['config']['tenancy.filesystem.suffix_base'] . $tenant->id; // storage_path() - $this->app->useStoragePath($this->originalPaths['storage'] . "/{$suffix}"); + if ($this->app['config']['tenancy.filesystem.suffix_storage_path'] ?? true) { + $this->app->useStoragePath($this->originalPaths['storage'] . "/{$suffix}"); + } // asset() if ($this->originalPaths['asset_url']) {