mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 10:54:04 +00:00
Fix tenants:list
This commit is contained in:
parent
ed200ab733
commit
43d75cdd38
3 changed files with 9 additions and 8 deletions
|
|
@ -118,6 +118,9 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
protected function makeTenancyMiddlewareHighestPriority()
|
protected function makeTenancyMiddlewareHighestPriority()
|
||||||
{
|
{
|
||||||
$tenancyMiddleware = [
|
$tenancyMiddleware = [
|
||||||
|
// Even higher priority than the initialization middleware
|
||||||
|
Middleware\PreventAccessFromCentralDomains::class,
|
||||||
|
|
||||||
Middleware\InitializeTenancyByDomain::class,
|
Middleware\InitializeTenancyByDomain::class,
|
||||||
Middleware\InitializeTenancyBySubdomain::class,
|
Middleware\InitializeTenancyBySubdomain::class,
|
||||||
Middleware\InitializeTenancyByDomainOrSubdomain::class,
|
Middleware\InitializeTenancyByDomainOrSubdomain::class,
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,11 @@ use Stancl\Tenancy\Middleware\PreventAccessFromCentralDomains;
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Route::group([
|
Route::middleware([
|
||||||
'middleware' => ['web', PreventAccessFromCentralDomains::class, InitializeTenancyByDomain::class],
|
'web',
|
||||||
'prefix' => '/app',
|
InitializeTenancyByDomain::class,
|
||||||
], function () {
|
PreventAccessFromCentralDomains::class,
|
||||||
|
])->group(function () {
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id');
|
return 'This is your multi-tenant application. The id of the current tenant is ' . tenant('id');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,9 @@ class TenantList extends Command
|
||||||
$this->info('Listing all tenants.');
|
$this->info('Listing all tenants.');
|
||||||
tenancy()
|
tenancy()
|
||||||
->query()
|
->query()
|
||||||
->when($this->option('tenants'), function ($query) {
|
|
||||||
$query->whereIn(tenancy()->model()->getTenantKeyName(), $this->option('tenants'));
|
|
||||||
})
|
|
||||||
->cursor()
|
->cursor()
|
||||||
->each(function (Tenant $tenant) {
|
->each(function (Tenant $tenant) {
|
||||||
$this->line("[Tenant] id: {$tenant['id']} @ " . implode('; ', $tenant->domains ?? []));
|
$this->line("[Tenant] id: {$tenant['id']} @ " . implode('; ', $tenant->domains->pluck('domain')->toArray() ?? []));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue