Skip to content

Commit

Permalink
Checking for null
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Sep 17, 2017
1 parent 776b959 commit 476fd8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Modules/Page/Repositories/Eloquent/EloquentPageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}%");
Expand All @@ -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'), '.')) {
Expand Down

0 comments on commit 476fd8b

Please sign in to comment.