a
This commit is contained in:
parent
c5cf8dd814
commit
3a22a9dda3
@ -124,16 +124,18 @@ trait OrderCardConcern
|
|||||||
$relation->where('transaction_no', 'like', "%{$conditions['transaction_no']}%");
|
$relation->where('transaction_no', 'like', "%{$conditions['transaction_no']}%");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isset($conditions['card_status'])) {
|
||||||
switch ($conditions['card_status']) {
|
switch ($conditions['card_status']) {
|
||||||
case 0:
|
case 0:
|
||||||
$query->whereNull('service_start_at')->whereHas('card', function ($relation) {
|
$this->model = $this->model->whereNull('service_start_at')->whereHas('card', function ($relation) {
|
||||||
$relation->whereNull('cancelled_at');
|
$relation->whereNull('cancelled_at');
|
||||||
})->where('created_at', '<', Carbon::now()->subMonths(6));
|
})->where('created_at', '<', Carbon::now()->subMonths(6));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
$query->whereNull('service_start_at')->whereHas('card', function ($relation) {
|
$this->model = $this->model->whereNull('service_start_at')->whereHas('card', function ($relation) {
|
||||||
$relation->whereNull('cancelled_at');
|
$relation->whereNull('cancelled_at');
|
||||||
})->where('created_at', '>=', Carbon::now()->subMonths(6));
|
})->where('created_at', '>=', Carbon::now()->subMonths(6));
|
||||||
break;
|
break;
|
||||||
@ -141,7 +143,7 @@ trait OrderCardConcern
|
|||||||
case 2:
|
case 2:
|
||||||
$havingRaw = sprintf("MAX(service_end_at) >= '%s'", date('Y-m-d H:i:s'));
|
$havingRaw = sprintf("MAX(service_end_at) >= '%s'", date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
$query->whereNotNull('service_start_at')
|
$this->model = $this->model->whereNotNull('service_start_at')
|
||||||
->groupBy('sim')->havingRaw($havingRaw)
|
->groupBy('sim')->havingRaw($havingRaw)
|
||||||
->whereHas('card', function ($relation) {
|
->whereHas('card', function ($relation) {
|
||||||
$relation->whereNull('cancelled_at');
|
$relation->whereNull('cancelled_at');
|
||||||
@ -151,7 +153,7 @@ trait OrderCardConcern
|
|||||||
case 3:
|
case 3:
|
||||||
$havingRaw = sprintf("MAX(service_end_at) < '%s'", date('Y-m-d H:i:s'));
|
$havingRaw = sprintf("MAX(service_end_at) < '%s'", date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
$query->whereNotNull('service_start_at')
|
$this->model = $this->model->whereNotNull('service_start_at')
|
||||||
->groupBy('sim')->havingRaw($havingRaw)
|
->groupBy('sim')->havingRaw($havingRaw)
|
||||||
->whereHas('card', function ($relation) {
|
->whereHas('card', function ($relation) {
|
||||||
$relation->whereNull('cancelled_at');
|
$relation->whereNull('cancelled_at');
|
||||||
@ -159,7 +161,7 @@ trait OrderCardConcern
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
$query->whereHas('card', function ($relation) {
|
$this->model = $this->model->whereHas('card', function ($relation) {
|
||||||
$relation->whereNotNull('cancelled_at');
|
$relation->whereNotNull('cancelled_at');
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -168,7 +170,7 @@ trait OrderCardConcern
|
|||||||
# code...
|
# code...
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user