mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-04 13:34:03 +00:00
improve docblocks
This commit is contained in:
parent
8620985a7c
commit
4fd7233285
2 changed files with 18 additions and 11 deletions
|
|
@ -95,9 +95,9 @@ return [
|
||||||
* This is used for determining if a path identification middleware is used
|
* This is used for determining if a path identification middleware is used
|
||||||
* during operations specific to path identification.
|
* during operations specific to path identification.
|
||||||
*
|
*
|
||||||
* Currently, this is only used for forgetting the tenant parameter using the ForgetTenantParameter listener.
|
* This is used for forgetting the tenant parameter using the ForgetTenantParameter listener.
|
||||||
* The listener only has an effect when path identification middleware
|
* The listener only has an effect when path identification middleware
|
||||||
* is used in the global middleware stack and certain conditions are met.
|
* is used in the global middleware stack and certain other conditions are met.
|
||||||
*
|
*
|
||||||
* If you're using a custom path identification middleware, add it here.
|
* If you're using a custom path identification middleware, add it here.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ use Stancl\Tenancy\Resolvers\DomainTenantResolver;
|
||||||
class TenancyServiceProvider extends ServiceProvider
|
class TenancyServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
public static Closure|null $configure = null;
|
public static Closure|null $configure = null;
|
||||||
|
public static bool $registerForgetTenantParameterListener = true;
|
||||||
|
public static bool $migrateFreshOverride = true;
|
||||||
|
|
||||||
/* Register services. */
|
/* Register services. */
|
||||||
public function register(): void
|
public function register(): void
|
||||||
|
|
@ -104,9 +106,11 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
Commands\CreateUserWithRLSPolicies::class,
|
Commands\CreateUserWithRLSPolicies::class,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (static::$migrateFreshOverride) {
|
||||||
$this->app->extend(FreshCommand::class, function ($_, $app) {
|
$this->app->extend(FreshCommand::class, function ($_, $app) {
|
||||||
return new Commands\MigrateFreshOverride($app['migrator']);
|
return new Commands\MigrateFreshOverride($app['migrator']);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$this->publishes([
|
$this->publishes([
|
||||||
__DIR__ . '/../assets/config.php' => config_path('tenancy.php'),
|
__DIR__ . '/../assets/config.php' => config_path('tenancy.php'),
|
||||||
|
|
@ -152,11 +156,14 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
Route::middlewareGroup('tenant', []);
|
Route::middlewareGroup('tenant', []);
|
||||||
Route::middlewareGroup('central', []);
|
Route::middlewareGroup('central', []);
|
||||||
|
|
||||||
// Always register the ForgetTenantParameter listener
|
if (static::$registerForgetTenantParameterListener) {
|
||||||
// even if path identification is not used.
|
// Ideally, this listener would only be registered when kernel-level
|
||||||
//
|
// path identification is used, however doing that check reliably
|
||||||
// Though the listener really only has an effect
|
// at this point in the lifecycle isn't feasible. For that reason,
|
||||||
// when path identification is used in the global stack.
|
// rather than doing an "outer" check, we do an "inner" check within
|
||||||
|
// that listener. That also means the listener needs to be registered
|
||||||
|
// always. We allow for this to be controlled using a static property.
|
||||||
Event::listen(RouteMatched::class, ForgetTenantParameter::class);
|
Event::listen(RouteMatched::class, ForgetTenantParameter::class);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue