From 7048a6af8db70e149ca6d37a404b7c03e37a5ef8 Mon Sep 17 00:00:00 2001 From: denghy Date: Tue, 19 Nov 2019 17:21:38 +0800 Subject: [PATCH] orWhere --- .../Virtual/Repositories/Concerns/OrderCardConcern.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Domains/Virtual/Repositories/Concerns/OrderCardConcern.php b/app/Domains/Virtual/Repositories/Concerns/OrderCardConcern.php index c49db91c..d90f979a 100644 --- a/app/Domains/Virtual/Repositories/Concerns/OrderCardConcern.php +++ b/app/Domains/Virtual/Repositories/Concerns/OrderCardConcern.php @@ -173,13 +173,13 @@ trait OrderCardConcern switch ($conditions['card_status']) { case 0: $this->model = $this->model->whereNull('service_start_at')->whereHas('card', function ($relation) { - $relation->whereNull('cancelled_at')->where('cancelled_at', "<", date('Y-m-d H:i:s')); + $relation->whereNull('cancelled_at')->orWhere('cancelled_at', "<", date('Y-m-d H:i:s')); })->where('created_at', '<', Carbon::now()->subMonths(6)); break; case 1: $this->model = $this->model->whereNull('service_start_at')->whereHas('card', function ($relation) { - $relation->whereNull('cancelled_at')->where('cancelled_at', "<", date('Y-m-d H:i:s')); + $relation->whereNull('cancelled_at')->orWhere('cancelled_at', "<", date('Y-m-d H:i:s')); })->where('created_at', '>=', Carbon::now()->subMonths(6)); break; @@ -189,7 +189,7 @@ trait OrderCardConcern $this->model = $this->model->whereNotNull('service_start_at') ->groupBy('sim')->havingRaw($havingRaw) ->whereHas('card', function ($relation) { - $relation->whereNull('cancelled_at')->where('cancelled_at', "<", date('Y-m-d H:i:s')); + $relation->whereNull('cancelled_at')->orWhere('cancelled_at', "<", date('Y-m-d H:i:s')); }); break; @@ -199,7 +199,7 @@ trait OrderCardConcern $this->model = $this->model->whereNotNull('service_start_at') ->groupBy('sim')->havingRaw($havingRaw) ->whereHas('card', function ($relation) { - $relation->whereNull('cancelled_at')->where('cancelled_at', "<", date('Y-m-d H:i:s')); + $relation->whereNull('cancelled_at')->orWhere('cancelled_at', "<", date('Y-m-d H:i:s')); }); break;