Issue #5654 fixed
This commit is contained in:
parent
32b6bd2bbe
commit
b2a7d68846
|
|
@ -54,11 +54,11 @@ class NotificationController extends Controller
|
|||
{
|
||||
$params = request()->all();
|
||||
|
||||
if (isset($params) && isset($params['page'])) {
|
||||
if (isset($params['page'])) {
|
||||
unset($params['page']);
|
||||
}
|
||||
|
||||
if (isset($params) && $params != NULL) {
|
||||
if (count($params)) {
|
||||
$searchResults = $this->notificationRepository->getParamsData($params);
|
||||
} else {
|
||||
$searchResults = $this->notificationRepository->with('order')->latest()->paginate(10);
|
||||
|
|
@ -66,7 +66,7 @@ class NotificationController extends Controller
|
|||
|
||||
return [
|
||||
'search_results' => $searchResults,
|
||||
'total_unread' => $this->notificationRepository->where('read', 0)->count()
|
||||
'total_unread' => $this->notificationRepository->where('read', 0)->count(),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ class NotificationController extends Controller
|
|||
|
||||
if ($notification = $this->notificationRepository->where('order_id', $orderId)->first()) {
|
||||
$notification->read = 1;
|
||||
|
||||
|
||||
$notification->save();
|
||||
|
||||
return redirect()->route('admin.sales.orders.view',$orderId);
|
||||
|
|
|
|||
|
|
@ -24,19 +24,21 @@ class NotificationRepository extends Repository
|
|||
public function getParamsData($params)
|
||||
{
|
||||
if (isset($params['id']) && isset($params['status'])) {
|
||||
return $params['status'] != 'All' ? $this->model->where(function($qry)use ($params) {
|
||||
return $params['status'] != 'All' ? $this->model->where(function($qry) use ($params) {
|
||||
$qry->whereHas('order',function ($q) use ($params) {
|
||||
$q->where(['status' => $params['status']]);
|
||||
});
|
||||
})->where('order_id', $params['id'])->with('order')->paginate(10) : $this->model->where('order_id', $params['id'])->with('order')->paginate(10) ;
|
||||
} else if (isset($params['status'])) {
|
||||
return $params['status'] != 'All' ? $this->model->where(function($qry)use ($params){
|
||||
return $params['status'] != 'All' ? $this->model->where(function($qry) use ($params) {
|
||||
$qry->whereHas('order',function ($q) use ($params) {
|
||||
$q->where(['status' => $params['status']]);
|
||||
});
|
||||
})->with('order')->paginate(10): $this->model->with('order')->latest()->paginate(10);
|
||||
} else if(isset($params['read']) && isset($params['limit'])) {
|
||||
return $this->model->where('read', $params['read'])->limit($params['limit'])->with('order')->latest()->paginate($params['limit']);
|
||||
} else if(isset($params['limit'])) {
|
||||
return $this->model->limit($params['limit'])->with('order')->latest()->paginate($params['limit']);
|
||||
return $this->model;
|
||||
} else if(isset($params['id'])) {
|
||||
return $this->model->where('order_id', $params['id'])->with('order')->paginate(10);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue