1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-09-20 14:34:03 +00:00

Improve symlink comments

Make it clear that both diskRoot and publicPath get the same prefix appended.

In the possibleTenantSymlinks() docblock, correct the array example (the values are not just 'disk root' anymore -- if the disk has a prefix, it will be appended to the configured root).
This commit is contained in:
lukinovec 2026-09-10 12:32:14 +02:00
parent 1e1e2efb8c
commit 9e890e9a67

View file

@ -16,7 +16,7 @@ use Stancl\Tenancy\Contracts\Tenant;
trait DealsWithTenantSymlinks trait DealsWithTenantSymlinks
{ {
/** /**
* Get all possible tenant symlinks, existing or not (array of ['public path' => 'disk root']). * Get all possible tenant symlinks, existing or not (array of ['public path' => 'disk root with the disk's prefix appended']).
* *
* Tenants can have a symlink for each local disk that is listed * Tenants can have a symlink for each local disk that is listed
* in both tenancy.filesystem.disks and tenancy.filesystem.url_override. * in both tenancy.filesystem.disks and tenancy.filesystem.url_override.
@ -61,9 +61,11 @@ trait DealsWithTenantSymlinks
$diskRoot = $tenantDisks[$disk]['root']; $diskRoot = $tenantDisks[$disk]['root'];
if ($prefix = trim($disks[$disk]['prefix'] ?? '', '/\\')) { if ($prefix = trim($disks[$disk]['prefix'] ?? '', '/\\')) {
// Append the disk's prefix to the disk root
$diskRoot = rtrim($diskRoot, '/\\') . DIRECTORY_SEPARATOR . $prefix; $diskRoot = rtrim($diskRoot, '/\\') . DIRECTORY_SEPARATOR . $prefix;
// Storage::url() appends the disk's prefix to the url, so the prefix has to be in the public path as well // Append the same prefix to the public path.
// Storage::url() appends the disk's prefix to the url, so the prefix has to be in the public path as well.
$publicPath .= DIRECTORY_SEPARATOR . $prefix; $publicPath .= DIRECTORY_SEPARATOR . $prefix;
} }