From cd70b57b83eb83a8cd8fcf2f3d9ee8b0841831f6 Mon Sep 17 00:00:00 2001 From: "j.stein" Date: Sat, 12 Feb 2022 13:18:35 +0100 Subject: [PATCH] Laravel 6 compatible --- src/Database/Concerns/PendingScope.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Database/Concerns/PendingScope.php b/src/Database/Concerns/PendingScope.php index c5fad50c..aaa48bfe 100644 --- a/src/Database/Concerns/PendingScope.php +++ b/src/Database/Concerns/PendingScope.php @@ -71,7 +71,11 @@ class PendingScope implements Scope { $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; }); @@ -87,7 +91,9 @@ class PendingScope implements Scope { $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; });