1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-06 16:14:05 +00:00

Remove tenant ordering

This commit is contained in:
lukinovec 2022-09-30 11:10:03 +02:00
parent b211cf1caf
commit a346ec450e
2 changed files with 3 additions and 10 deletions

View file

@ -29,14 +29,6 @@ class Run extends Command
$argvInput = $this->ArgvInput();
$tenants = $this->getTenants();
if ($this->option('tenants')) {
// $this->getTenants() doesn't return tenants in the same order as the tenants passed in the tenants option
// Map the passed tenant keys to the fetched tenant models to correct the order
$tenants = array_map(function (string $tenantKey) use ($tenants) {
return $tenants->filter(fn (Tenant $tenant) => $tenant->getTenantKey() === $tenantKey)->first();
}, $this->option('tenants'));
}
tenancy()->runForMultiple($tenants, function ($tenant) use ($argvInput) {
$this->line("Tenant: {$tenant->getTenantKey()}");