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)
-
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...
-
How to Answer Technical Questions Like a Pro Answering technical interview questions is all about showing off your problem-solving skills an...
-
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...
No comments:
Post a Comment