return $places = Place::where('name', 'like', '%' . $request->name . '%')
->whereHas('eatCategories', function($q) use($kitchen){
$q->WhereIn('eat_category_id', $kitchen);
})
->whereHas('services', function($q) use($service){
$q->WhereIn('service_id', $service);
})
->whereHas('paymentMethods', function($q) use($payment){
$q->WhereIn('place_attribute_id', $payment);
})->get();
My query is working but if the variables are empty, the query is not working until all is full.
$q->WhereIn('eat_category_id', $kitchen);
If $kitchen is empty, how can I resume the query?
My route :
Route::get('/api/get-filter-places/{name?}/{kitchen?}/{service?}/{payment?}', 'FrontController@getFilterPlaces');
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire