mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 06:44:04 +00:00
resolve minor todos
This commit is contained in:
parent
413da36c4a
commit
7089efb2ee
7 changed files with 44 additions and 9 deletions
|
|
@ -21,6 +21,21 @@ use Stancl\Tenancy\Middleware\InitializeTenancyByPath;
|
|||
use Stancl\Tenancy\Middleware\InitializeTenancyByRequestData;
|
||||
use Stancl\Tenancy\Bootstrappers\Integrations\FortifyRouteBootstrapper;
|
||||
|
||||
/**
|
||||
* Tenancy for Laravel.
|
||||
*
|
||||
* Documentation: https://tenancyforlaravel.com
|
||||
*
|
||||
* We can sustainably develop Tenancy for Laravel thanks to our sponsors.
|
||||
* Big thanks to everyone listed here: https://github.com/sponsors/stancl
|
||||
*
|
||||
* You can also support us, and save time, by purchasing these products:
|
||||
* Exclusive content for sponsors: https://sponsors.tenancyforlaravel.com
|
||||
* Multi-Tenant SaaS boilerplate: https://portal.archte.ch/boilerplate
|
||||
* Multi-Tenant Laravel in Production e-book: https://portal.archte.ch/book
|
||||
*
|
||||
* All of these products can also be accessed at https://portal.archte.ch
|
||||
*/
|
||||
class TenancyServiceProvider extends ServiceProvider
|
||||
{
|
||||
// By default, no namespace is used to support the callable array syntax.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,21 @@ use Stancl\Tenancy\Bootstrappers;
|
|||
use Stancl\Tenancy\Enums\RouteMode;
|
||||
use Stancl\Tenancy\UniqueIdentifierGenerators;
|
||||
|
||||
/**
|
||||
* Tenancy for Laravel.
|
||||
*
|
||||
* Documentation: https://tenancyforlaravel.com
|
||||
*
|
||||
* We can sustainably develop Tenancy for Laravel thanks to our sponsors.
|
||||
* Big thanks to everyone listed here: https://github.com/sponsors/stancl
|
||||
*
|
||||
* You can also support us, and save time, by purchasing these products:
|
||||
* Exclusive content for sponsors: https://sponsors.tenancyforlaravel.com
|
||||
* Multi-Tenant SaaS boilerplate: https://portal.archte.ch/boilerplate
|
||||
* Multi-Tenant Laravel in Production e-book: https://portal.archte.ch/book
|
||||
*
|
||||
* All of these products can also be accessed at https://portal.archte.ch
|
||||
*/
|
||||
return [
|
||||
/**
|
||||
* Configuration for the models used by Tenancy.
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ services:
|
|||
image: mcr.microsoft.com/mssql/server:2022-latest
|
||||
environment:
|
||||
- ACCEPT_EULA=Y
|
||||
- SA_PASSWORD=P@ssword # todo reuse env from above
|
||||
- SA_PASSWORD=P@ssword # must be the same as TENANCY_TEST_SQLSRV_PASSWORD
|
||||
healthcheck: # https://github.com/Microsoft/mssql-docker/issues/133#issuecomment-1995615432
|
||||
test: timeout 2 bash -c 'cat < /dev/null > /dev/tcp/127.0.0.1/1433'
|
||||
interval: 10s
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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')) {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ beforeEach(function () {
|
|||
Event::listen(TenancyEnded::class, RevertToCentralContext::class);
|
||||
});
|
||||
|
||||
// todo@move move these to be in the same file as the other tests from this PR (#909) rather than generic "action tests"
|
||||
|
||||
test('create storage symlinks action works', function() {
|
||||
config([
|
||||
'tenancy.bootstrappers' => [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue