mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-04 08:44:04 +00:00
Refactor forgetDisks to handle scoped disks
This commit is contained in:
parent
99d854ed8e
commit
2a864e237e
1 changed files with 13 additions and 1 deletions
|
|
@ -113,7 +113,19 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
|||
|
||||
protected function forgetDisks(): void
|
||||
{
|
||||
Storage::forgetDisk($this->app['config']['tenancy.filesystem.disks']);
|
||||
$tenantDisks = $this->app['config']['tenancy.filesystem.disks'];
|
||||
$scopedDisks = [];
|
||||
|
||||
foreach ($this->app['config']['filesystems.disks'] as $name => $disk) {
|
||||
if (isset($disk['driver'], $disk['disk'])
|
||||
&& $disk['driver'] === 'scoped'
|
||||
&& in_array($disk['disk'], $tenantDisks, true)
|
||||
&& ! in_array($disk['disk'], $scopedDisks, true)) {
|
||||
$scopedDisks[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
Storage::forgetDisk([...$tenantDisks, ...$scopedDisks]);
|
||||
}
|
||||
|
||||
protected function diskRoot(string $disk, Tenant|false $tenant): void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue