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

Merge branch 'master' into cache-prefix

This commit is contained in:
lukinovec 2023-01-31 08:17:22 +01:00 committed by GitHub
commit ba8cfdda85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 631 additions and 362 deletions

View file

@ -28,14 +28,16 @@ class TenancyServiceProvider extends ServiceProvider
Jobs\CreateDatabase::class,
Jobs\MigrateDatabase::class,
// Jobs\SeedDatabase::class,
Jobs\CreateStorageSymlinks::class,
// Jobs\CreateStorageSymlinks::class,
// Your own jobs to prepare the tenant.
// Provision API keys, create S3 buckets, anything you want!
])->send(function (Events\TenantCreated $event) {
return $event->tenant;
})->shouldBeQueued(false), // `false` by default, but you probably want to make this `true` for production.
// Listeners\CreateTenantStorage::class,
],
Events\SavingTenant::class => [],
Events\TenantSaved::class => [],
@ -53,7 +55,7 @@ class TenancyServiceProvider extends ServiceProvider
Events\TenantDeleted::class => [
JobPipeline::make([
Jobs\DeleteDatabase::class,
Jobs\RemoveStorageSymlinks::class,
// Jobs\RemoveStorageSymlinks::class,
])->send(function (Events\TenantDeleted $event) {
return $event->tenant;
})->shouldBeQueued(false), // `false` by default, but you probably want to make this `true` for production.
@ -153,7 +155,7 @@ class TenancyServiceProvider extends ServiceProvider
protected function makeTenancyMiddlewareHighestPriority()
{
// PreventAccessFromCentralDomains has even higher priority than the identification middleware
$tenancyMiddleware = array_merge([Middleware\PreventAccessFromCentralDomains::class], config('tenancy.identification.middleware'));
$tenancyMiddleware = array_merge([Middleware\PreventAccessFromUnwantedDomains::class], config('tenancy.identification.middleware'));
foreach (array_reverse($tenancyMiddleware) as $middleware) {
$this->app[\Illuminate\Contracts\Http\Kernel::class]->prependToMiddlewarePriority($middleware);

View file

@ -103,6 +103,7 @@ return [
Stancl\Tenancy\Bootstrappers\QueueTenancyBootstrapper::class,
Stancl\Tenancy\Bootstrappers\BatchTenancyBootstrapper::class,
// Stancl\Tenancy\Bootstrappers\PrefixCacheTenancyBootstrapper::class,
// Stancl\Tenancy\Bootstrappers\SessionTenancyBootstrapper::class,
// Stancl\Tenancy\Bootstrappers\MailTenancyBootstrapper::class, // Queueing mail requires using QueueTenancyBootstrapper with $forceRefresh set to true
// Stancl\Tenancy\Bootstrappers\RedisTenancyBootstrapper::class, // Note: phpredis is needed
],
@ -284,7 +285,6 @@ return [
'features' => [
// Stancl\Tenancy\Features\UserImpersonation::class,
// Stancl\Tenancy\Features\TelescopeTags::class,
// Stancl\Tenancy\Features\UniversalRoutes::class,
// Stancl\Tenancy\Features\TenantConfig::class, // https://tenancyforlaravel.com/docs/v3/features/tenant-config
// Stancl\Tenancy\Features\CrossDomainRedirect::class, // https://tenancyforlaravel.com/docs/v3/features/cross-domain-redirect
],

View file

@ -4,7 +4,7 @@ declare(strict_types=1);
use Illuminate\Support\Facades\Route;
use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
use Stancl\Tenancy\Middleware\PreventAccessFromCentralDomains;
use Stancl\Tenancy\Middleware\PreventAccessFromUnwantedDomains;
/*
|--------------------------------------------------------------------------
@ -21,7 +21,7 @@ use Stancl\Tenancy\Middleware\PreventAccessFromCentralDomains;
Route::middleware([
'web',
InitializeTenancyByDomain::class,
PreventAccessFromCentralDomains::class,
PreventAccessFromUnwantedDomains::class,
])->group(function () {
Route::get('/', function () {
return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id');