mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 08:54:06 +00:00
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
This commit is contained in:
parent
b4a4eab949
commit
a2c8218e6a
1 changed files with 3 additions and 1 deletions
|
|
@ -58,12 +58,14 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
||||||
/** @var FilesystemAdapter $filesystemDisk */
|
/** @var FilesystemAdapter $filesystemDisk */
|
||||||
$filesystemDisk = Storage::disk($disk);
|
$filesystemDisk = Storage::disk($disk);
|
||||||
$this->originalPaths['disks'][$disk] = $filesystemDisk->getAdapter()->getPathPrefix();
|
$this->originalPaths['disks'][$disk] = $filesystemDisk->getAdapter()->getPathPrefix();
|
||||||
|
$subject = $this->app['config']["tenancy.filesystem.root_override.{$disk}"] ?? '';
|
||||||
|
|
||||||
if ($root = str_replace(
|
if ($root = str_replace(
|
||||||
'%storage_path%',
|
'%storage_path%',
|
||||||
storage_path(),
|
storage_path(),
|
||||||
$this->app['config']["tenancy.filesystem.root_override.{$disk}"] ?? ''
|
$subject
|
||||||
)) {
|
)) {
|
||||||
|
$root = str_replace('%tenant%', $suffix, $subject);
|
||||||
$filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root);
|
$filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root);
|
||||||
} else {
|
} else {
|
||||||
$root = $this->app['config']["filesystems.disks.{$disk}.root"];
|
$root = $this->app['config']["filesystems.disks.{$disk}.root"];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue