mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 08:44:04 +00:00
Add tenant key resolver to define filesystem path suffix
This commit is contained in:
parent
db9480f54e
commit
88ebe97991
1 changed files with 11 additions and 1 deletions
|
|
@ -17,6 +17,9 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
|||
/** @var array */
|
||||
public $originalPaths = [];
|
||||
|
||||
/** @var callable */
|
||||
protected static $tenantKeyResolver;
|
||||
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
|
|
@ -33,9 +36,16 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
|||
});
|
||||
}
|
||||
|
||||
public static function resolveTenantKeyUsing(callable $tenantKeyResolver): void
|
||||
{
|
||||
static::$tenantKeyResolver = $tenantKeyResolver;
|
||||
}
|
||||
|
||||
public function bootstrap(Tenant $tenant)
|
||||
{
|
||||
$suffix = $this->app['config']['tenancy.filesystem.suffix_base'] . $tenant->getTenantKey();
|
||||
$tenantKey = static::$tenantKeyResolver ? (static::$tenantKeyResolver)($tenant) : $tenant->getTenantKey();
|
||||
|
||||
$suffix = $this->app['config']['tenancy.filesystem.suffix_base'] . $tenantKey;
|
||||
|
||||
// storage_path()
|
||||
if ($this->app['config']['tenancy.filesystem.suffix_storage_path'] ?? true) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue