1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-15 07:24:03 +00:00

Rewrite old tests

This commit is contained in:
Samuel Štancl 2020-05-12 23:22:40 +02:00
parent 64383b4c56
commit 89936187ce
71 changed files with 698 additions and 3203 deletions

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Commands;
use Illuminate\Console\Command;
use Stancl\Tenancy\Contracts\Tenant;
class TenantList extends Command
{
@ -30,8 +31,14 @@ class TenantList extends Command
public function handle()
{
$this->info('Listing all tenants.');
tenancy()->all()->each(function ($tenant) {
$this->line("[Tenant] id: {$tenant['id']} @ " . implode('; ', $tenant->domains));
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 ?? []));
});
}
}