From 476fd8bc0c74cda1bb08fce2bbd778cd4843da81 Mon Sep 17 00:00:00 2001 From: Nicolas Widart Date: Sun, 17 Sep 2017 12:10:11 +0200 Subject: [PATCH] Checking for null --- Modules/Page/Repositories/Eloquent/EloquentPageRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Page/Repositories/Eloquent/EloquentPageRepository.php b/Modules/Page/Repositories/Eloquent/EloquentPageRepository.php index aaecbd68f..6b78ec0df 100644 --- a/Modules/Page/Repositories/Eloquent/EloquentPageRepository.php +++ b/Modules/Page/Repositories/Eloquent/EloquentPageRepository.php @@ -139,7 +139,7 @@ public function serverPaginationFilteringFor(Request $request): LengthAwarePagin { $pages = $this->allWithBuilder(); - if ($request->has('search')) { + if ($request->get('search') !== null) { $term = $request->get('search'); $pages->whereHas('translations', function($query) use($term) { $query->where('title', 'LIKE', "%{$term}%"); @@ -148,7 +148,7 @@ public function serverPaginationFilteringFor(Request $request): LengthAwarePagin ->orWhere('id', $term); } - if ($request->has('order_by') && $request->get('order_by') !== 'undefined' && $request->get('order') !== 'null') { + if ($request->get('order_by') !== null && $request->get('order') !== 'null') { $order = $request->get('order') === 'ascending' ? 'asc' : 'desc'; if (str_contains($request->get('order_by'), '.')) {