Skip to content

Commit

Permalink
Set config() disk root too
Browse files Browse the repository at this point in the history
  • Loading branch information
stancl authored Jul 14, 2020
1 parent 3693040 commit 51cdf55
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/TenancyBootstrappers/FilesystemTenancyBootstrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ public function start(Tenant $tenant)
$this->originalPaths['disks'][$disk] = $filesystemDisk->getAdapter()->getPathPrefix();

if ($root = str_replace('%storage_path%', storage_path(), $this->app['config']["tenancy.filesystem.root_override.{$disk}"])) {
$filesystemDisk->getAdapter()->setPathPrefix($root);
$filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root);
} else {
$root = $this->app['config']["filesystems.disks.{$disk}.root"];

$filesystemDisk->getAdapter()->setPathPrefix($root . "/{$suffix}");
$filesystemDisk->getAdapter()->setPathPrefix($finalPrefix = $root . "/{$suffix}");
}

$this->app['config']["filesystems.disks.{$disk}.root"] = $finalPrefix;
}
}

Expand All @@ -83,7 +84,10 @@ public function end()
/** @var FilesystemAdapter $filesystemDisk */
$filesystemDisk = Storage::disk($disk);

$filesystemDisk->getAdapter()->setPathPrefix($this->originalPaths['disks'][$disk]);
$root = $this->originalPaths['disks'][$disk];

$filesystemDisk->getAdapter()->setPathPrefix($root);
$this->app['config']["filesystems.disks.{$disk}.root"] = $root;
}
}
}

0 comments on commit 51cdf55

Please sign in to comment.