mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 20:04:02 +00:00
Wrap withoutPending where clauses in a closure
Prevent issues like `Tenant::withoutPending()->where('id', 'nonexistent-id')->first()` returning the first non-pending tenant.
This commit is contained in:
parent
f881203af8
commit
eed66c93f1
1 changed files with 4 additions and 2 deletions
|
|
@ -58,8 +58,10 @@ class PendingScope implements Scope
|
|||
{
|
||||
$builder->macro('withoutPending', function (Builder $builder) {
|
||||
$builder->withoutGlobalScope(static::class)
|
||||
->whereNull($builder->getModel()->getColumnForQuery('pending_since'))
|
||||
->where(function (Builder $builder) {
|
||||
$builder->whereNull($builder->getModel()->getColumnForQuery('pending_since'))
|
||||
->orWhereNull($builder->getModel()->getDataColumn());
|
||||
});
|
||||
|
||||
return $builder;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue