1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 00:34:03 +00:00

get down to 59 phpstan errors

This commit is contained in:
Samuel Štancl 2022-09-29 22:20:55 +02:00
parent 193e044777
commit a94227a19c
26 changed files with 130 additions and 130 deletions

View file

@ -5,7 +5,7 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Concerns;
use Illuminate\Support\Collection;
use Stancl\Tenancy\Database\Models\Tenant;
use Stancl\Tenancy\Contracts\Tenant;
trait DealsWithTenantSymlinks
{
@ -23,12 +23,14 @@ trait DealsWithTenantSymlinks
$diskUrls = config('tenancy.filesystem.url_override');
$disks = config('tenancy.filesystem.root_override');
$suffixBase = config('tenancy.filesystem.suffix_base');
$symlinks = collect();
$tenantKey = $tenant->getTenantKey();
/** @var Collection<array<string, string>> $symlinks */
$symlinks = collect([]);
foreach ($diskUrls as $disk => $publicPath) {
$storagePath = str_replace('%storage_path%', $suffixBase . $tenantKey, $disks[$disk]);
$publicPath = str_replace('%tenant_id%', $tenantKey, $publicPath);
$publicPath = str_replace('%tenant_id%', (string) $tenantKey, $publicPath);
tenancy()->central(function () use ($symlinks, $publicPath, $storagePath) {
$symlinks->push([public_path($publicPath) => storage_path($storagePath)]);