From 5c1b9d5b2d147405bcc3876a16fa716a433fe1da Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 4 Jul 2021 09:02:16 +1000 Subject: [PATCH] Fixes for client credits --- app/Services/Client/ClientService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Services/Client/ClientService.php b/app/Services/Client/ClientService.php index a7f1021bb377..a33a576909f2 100644 --- a/app/Services/Client/ClientService.php +++ b/app/Services/Client/ClientService.php @@ -65,8 +65,10 @@ class ClientService return $this->client->credits() ->where('is_deleted', false) ->where('balance', '>', 0) - ->whereDate('due_date', '<=', now()->format('Y-m-d')) - ->orWhere('due_date', NULL) + ->where(function ($query){ + $query->whereDate('due_date', '<=', now()->format('Y-m-d')) + ->orWhereNull('due_date'); + }) ->orderBy('created_at','ASC'); }