return $query->when(!empty(request()->input('location', 0)), function($query) {
$query->whereHas('location', function($query) { $query->whereId(request()->input('location')); }); }) ->when(!empty(request()->input('category', 0)), function($query) { $query->whereHas('categories', function($query) { $query->whereId(request()->input('category')); }); }) ->when(!empty(request()->input('search', '')), function($query) { $query->where(function($query) { $search = request()->input('search'); $query->where('title', 'LIKE', "%$search%") ->orWhere('short_description', 'LIKE', "%$search%") ->orWhere('full_description', 'LIKE', "%$search%") ->orWhere('job_nature', 'LIKE', "%$search%") ->orWhere('requirements', 'LIKE', "%$search%") ->orWhere('address', 'LIKE', "%$search%") ->orWhereHas('company', function($query) use($search) { $query->where('name', 'LIKE', "%$search%"); }); }); });
Subscribe to:
Post Comments (Atom)
-
Vuetify is a popular UI framework for Vue apps. In this article, we’ll look at how to work with the Vuetify framework. Color Picker Inputs W...
-
Composer is a major part of the Laravel MVC Framework, but it also exists without Laravel. In fact you could use it in any project. This a...
-
concat() join() fill() includes() indexOf() reverse() sort() splice() at() copyWithin() flat() Array.from() findLastIndex() forEach() every(...
No comments:
Post a Comment