mirror of
https://github.com/archtechx/tenancy.git
synced 2026-09-20 13:54:03 +00:00
use DIRECTORY_SEPARATOR instead of hardcoded '/'
This commit is contained in:
parent
d8bed726d5
commit
a036e0eb11
1 changed files with 8 additions and 5 deletions
|
|
@ -97,7 +97,7 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
||||||
|
|
||||||
protected function tenantStoragePath(string $suffix): string
|
protected function tenantStoragePath(string $suffix): string
|
||||||
{
|
{
|
||||||
return $this->originalStoragePath . "/{$suffix}";
|
return $this->originalStoragePath . DIRECTORY_SEPARATOR . $suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function assetHelper(string|false $suffix): void
|
protected function assetHelper(string|false $suffix): void
|
||||||
|
|
@ -241,17 +241,20 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
||||||
*/
|
*/
|
||||||
protected function tenantScopedPath(string $configuredPath, string $suffix): string
|
protected function tenantScopedPath(string $configuredPath, string $suffix): string
|
||||||
{
|
{
|
||||||
if (str_starts_with($configuredPath, $this->originalStoragePath . '/')) {
|
// Normalize the path to use the separator of the current OS.
|
||||||
|
$configuredPath = str_replace('/', DIRECTORY_SEPARATOR, $configuredPath);
|
||||||
|
|
||||||
|
if (str_starts_with($configuredPath, $this->originalStoragePath . DIRECTORY_SEPARATOR)) {
|
||||||
// Swap the central storage path prefix for the tenant's.
|
// Swap the central storage path prefix for the tenant's.
|
||||||
// For example, storage_path('framework/cache/data') becomes storage_path('tenant1/framework/cache/data').
|
// For example, storage_path('framework/cache/data') becomes storage_path('tenant1/framework/cache/data').
|
||||||
return str($configuredPath)
|
return str($configuredPath)
|
||||||
->after($this->originalStoragePath . '/')
|
->after($this->originalStoragePath . DIRECTORY_SEPARATOR)
|
||||||
->prepend($this->tenantStoragePath($suffix) . '/')
|
->prepend($this->tenantStoragePath($suffix) . DIRECTORY_SEPARATOR)
|
||||||
->toString();
|
->toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise $configuredPath isn't necessarily storage_path()-based, so just append the suffix directly.
|
// Otherwise $configuredPath isn't necessarily storage_path()-based, so just append the suffix directly.
|
||||||
return rtrim($configuredPath, '/') . '/' . $suffix;
|
return rtrim($configuredPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeSessions(string|false $suffix): void
|
public function scopeSessions(string|false $suffix): void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue