mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 08:24: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()
|
||||
{
|
||||
$tenancyMiddleware = [
|
||||
// Even higher priority than the initialization middleware
|
||||
Middleware\PreventAccessFromCentralDomains::class,
|
||||
|
||||
Middleware\InitializeTenancyByDomain::class,
|
||||
Middleware\InitializeTenancyBySubdomain::class,
|
||||
Middleware\InitializeTenancyByDomainOrSubdomain::class,
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@ use Stancl\Tenancy\Middleware\PreventAccessFromCentralDomains;
|
|||
|
|
||||
*/
|
||||
|
||||
Route::group([
|
||||
'middleware' => ['web', PreventAccessFromCentralDomains::class, InitializeTenancyByDomain::class],
|
||||
'prefix' => '/app',
|
||||
], function () {
|
||||
Route::middleware([
|
||||
'web',
|
||||
InitializeTenancyByDomain::class,
|
||||
PreventAccessFromCentralDomains::class,
|
||||
])->group(function () {
|
||||
Route::get('/', function () {
|
||||
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.');
|
||||
tenancy()
|
||||
->query()
|
||||
->when($this->option('tenants'), function ($query) {
|
||||
$query->whereIn(tenancy()->model()->getTenantKeyName(), $this->option('tenants'));
|
||||
})
|
||||
->cursor()
|
||||
->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