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

Improve query formatting

This commit is contained in:
lukinovec 2022-11-28 14:43:16 +01:00
parent 3a6e673418
commit 9414b17f06
3 changed files with 3 additions and 6 deletions

View file

@ -41,8 +41,7 @@ class ClearPendingTenants extends Command
$expirationDate->subHours($olderThanHours);
}
$deletedTenantCount = tenancy()
->query()
$deletedTenantCount = tenancy()->query()
->onlyPending()
->when($originalExpirationDate->notEqualTo($expirationDate), function (Builder $query) use ($expirationDate) {
$query->where($query->getModel()->getColumnForQuery('pending_since'), '<', $expirationDate->timestamp);

View file

@ -39,8 +39,7 @@ class CreatePendingTenants extends Command
/** Calculate the number of currently available pending tenants. */
protected function getPendingTenantCount(): int
{
return tenancy()
->query()
return tenancy()->query()
->onlyPending()
->count();
}

View file

@ -23,8 +23,7 @@ trait HasTenantOptions
protected function getTenants(): LazyCollection
{
return tenancy()
->query()
return tenancy()->query()
->when($this->option('tenants'), function ($query) {
$query->whereIn(tenancy()->model()->getTenantKeyName(), $this->option('tenants'));
})