1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 21:34:03 +00:00

Remove obsolete files, restructure

This commit is contained in:
Samuel Štancl 2020-05-21 15:54:35 +02:00
parent fbe43fbb04
commit 4f8d892481
20 changed files with 19 additions and 83 deletions

View file

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Concerns;
use Illuminate\Support\LazyCollection;
use Symfony\Component\Console\Input\InputOption;
trait HasATenantsOption
{
protected function getOptions()
{
return array_merge([
['tenants', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, '', null],
], parent::getOptions());
}
protected function getTenants(): LazyCollection
{
return tenancy()
->query()
->when($this->option('tenants'), function ($query) {
$query->whereIn(tenancy()->model()->getTenantKeyName(), $this->option('tenants'));
})
->cursor();
}
public function __construct()
{
parent::__construct();
$this->specifyParameters();
}
}