1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 19:54:04 +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

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Traits;
use Illuminate\Support\LazyCollection;
use Symfony\Component\Console\Input\InputOption;
trait HasATenantsOption
@ -15,9 +16,14 @@ trait HasATenantsOption
], parent::getOptions());
}
protected function getTenants(): array
protected function getTenants(): LazyCollection
{
return tenancy()->all($this->option('tenants'))->all();
return tenancy()
->query()
->when($this->option('tenants'), function ($query) {
$query->whereIn(tenancy()->model()->getTenantKeyName(), $this->option('tenants'));
})
->cursor();
}
public function __construct()