Checking for null

parent 776b9593
......@@ -139,7 +139,7 @@ class EloquentPageRepository extends EloquentBaseRepository implements PageRepos
{
$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 @@ class EloquentPageRepository extends EloquentBaseRepository implements PageRepos
->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'), '.')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment