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

Laravel 6 compatible

This commit is contained in:
j.stein 2022-02-12 13:18:35 +01:00
parent 30b49a9d25
commit cd70b57b83

View file

@ -71,7 +71,11 @@ class PendingScope implements Scope
{ {
$builder->macro('withoutPending', function (Builder $builder) { $builder->macro('withoutPending', function (Builder $builder) {
$builder->withoutGlobalScope($this)->whereNull('data->pending_since'); // Only use whereNull('data->pending_since') when Laravel 6 support is dropped
// Issue fixed in Laravel 7 https://github.com/laravel/framework/pull/32417
$builder->withoutGlobalScope($this)
->where('data->pending_since', 'like', 'null')
->orWhereNull('data');
return $builder; return $builder;
}); });
@ -87,7 +91,9 @@ class PendingScope implements Scope
{ {
$builder->macro('onlyPending', function (Builder $builder) { $builder->macro('onlyPending', function (Builder $builder) {
$builder->withoutGlobalScope($this)->whereNotNull('data->pending_since'); // Use whereNotNull when Laravel 6 is dropped
// Issue fixed in Laravel 7 https://github.com/laravel/framework/pull/32417
$builder->withoutGlobalScope($this)->where('data->pending_since', 'not like', 'null');
return $builder; return $builder;
}); });