mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 17:14:03 +00:00
Update tenants option trait
This commit is contained in:
parent
fd809bc81a
commit
f92b682eb3
1 changed files with 7 additions and 6 deletions
|
|
@ -7,7 +7,10 @@ namespace Stancl\Tenancy\Concerns;
|
|||
use Illuminate\Support\LazyCollection;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
trait HasATenantsOption
|
||||
/**
|
||||
* Adds 'tenants' and 'with-pending' options.
|
||||
*/
|
||||
trait HasTenantOptions
|
||||
{
|
||||
protected function getOptions()
|
||||
{
|
||||
|
|
@ -24,14 +27,12 @@ trait HasATenantsOption
|
|||
->when($this->option('tenants'), function ($query) {
|
||||
$query->whereIn(tenancy()->model()->getTenantKeyName(), $this->option('tenants'));
|
||||
})
|
||||
->when(tenancy()->model()::hasGlobalScope(PendingScope::class), function($query) {
|
||||
$query->withPending($this->option('with-pending'));
|
||||
})
|
||||
->cursor();
|
||||
}
|
||||
|
||||
protected function withPending(): ?bool
|
||||
{
|
||||
return $this->option('with-pending') ? true : null;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
Loading…
Add table
Add a link
Reference in a new issue