mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 05:14:03 +00:00
Add tenant key resolver to define filesystem path suffix
This commit is contained in:
parent
23e614f05b
commit
a70312cb48
1 changed files with 11 additions and 1 deletions
|
|
@ -17,6 +17,9 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
|
||||||
/** @var array */
|
/** @var array */
|
||||||
public $originalPaths = [];
|
public $originalPaths = [];
|
||||||
|
|
||||||
|
/** @var callable */
|
||||||
|
protected static $tenantKeyResolver;
|
||||||
|
|
||||||
public function __construct(Application $app)
|
public function __construct(Application $app)
|
||||||
{
|
{
|
||||||
$this->app = $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)
|
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()
|
// storage_path()
|
||||||
if ($this->app['config']['tenancy.filesystem.suffix_storage_path'] ?? true) {
|
if ($this->app['config']['tenancy.filesystem.suffix_storage_path'] ?? true) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue