Skip to content

Commit

Permalink
[3.x][Filesystem] Provide an additional argument for tenant name path (
Browse files Browse the repository at this point in the history
…archtechx#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
  • Loading branch information
vstyler96 authored May 26, 2022
1 parent 4d95e88 commit 51228de
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Bootstrappers/FilesystemTenancyBootstrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}"] ?? '',
);

Expand Down

0 comments on commit 51228de

Please sign in to comment.