1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 19:14:04 +00:00

resolve minor todos

This commit is contained in:
Samuel Štancl 2025-08-18 15:04:42 +02:00
parent 413da36c4a
commit 7089efb2ee
7 changed files with 44 additions and 9 deletions

View file

@ -11,8 +11,6 @@ use Stancl\Tenancy\Concerns\UsableWithEarlyIdentification;
use Stancl\Tenancy\Enums\RouteMode;
/**
* todo@name come up with a better name.
*
* Prevents accessing central domains in the tenant context/tenant domains in the central context.
* The access isn't prevented if the request is trying to access a route flagged as 'universal',
* or if this middleware should be skipped.

View file

@ -24,7 +24,11 @@ class Tenancy
*/
public Tenant|null $tenant = null;
// todo@docblock
/**
* Custom callback for providing a list of bootstrappers to use.
* When this is null, config('tenancy.bootstrappers') is used.
* @var ?Closure(): list<TenancyBootstrapper>
*/
public ?Closure $getBootstrappersUsing = null;
/** Is tenancy fully initialized? */
@ -131,12 +135,12 @@ class Tenancy
/** @return TenancyBootstrapper[] */
public function getBootstrappers(): array
{
// If no callback for getting bootstrappers is set, we just return all of them.
// If no callback for getting bootstrappers is set, we return the ones in config.
$resolve = $this->getBootstrappersUsing ?? function (Tenant $tenant) {
return config('tenancy.bootstrappers');
};
// Here We instantiate the bootstrappers and return them.
// Here we instantiate the bootstrappers and return them.
return array_map('app', $resolve($this->tenant));
}

View file

@ -36,7 +36,12 @@ if (! function_exists('tenant')) {
}
if (! function_exists('tenant_asset')) {
// todo@docblock
/**
* Generate a URL to an asset in tenant storage.
*
* If app.asset_url is set, this helper suffixes that URL before appending the asset path.
* If it is not set, the stancl.tenancy.asset route is used.
*/
function tenant_asset(string|null $asset): string
{
if ($assetUrl = config('app.asset_url')) {