答案 0 :(得分:0)
如果要创建自定义存储磁盘,则可以在config/filesystems.php
下的disk
内添加此代码。
'tenancy' => [
'driver' => 'local',
'root' => storage_path('app/tenancy'),
],
因此您可以使用Storage::disk('tenancy')
例如
Storage::disk('tenancy')->get('tenants/64121.../images');
答案 1 :(得分:0)
我遇到了同样的问题,这是我使用Hyn 5.4的解决方案,您可以像这样检索Current Tenant:
https://laravel-tenancy.com/docs/hyn/5.4/identification#retrieve-current-tenant
// Get current Website (Tenant)
$website = \Hyn\Tenancy\Facades\TenancyFacade::website();
// prefered option
$website = app(\Hyn\Tenancy\Environment::class)->tenant();
// alternative (outdated)
$website = app(\Hyn\Tenancy\Environment::class)->website();
$websiteId = $website->id;
// Get current Hostname
$hostname = app(\Hyn\Tenancy\Environment::class)->hostname();
// Get FQDN (Fully-Qualified Domain Name) by current hostname
$fqdn = $hostname->fqdn;
您可以通过创建将链接到
租户媒体
https://laravel-tenancy.com/docs/hyn/5.4/structure#media
Route::get('/media/{path}', '\Hyn\Tenancy\Controllers\MediaController')
->where('path', '.+')
->name('tenant.media');