I have a view where I have search form with a city
select. In controller I request it and send it to model, in order to get filetered results, but if
statement doesn't work in model:
$query = DB::table('orders')...some where clauses etc...;//works
if ($city_id) {
$query->where('orders.location', '=', $city_id);
}
return $query->paginate(15);
I checked it with dd($city_id)
- it shows that requested value achieves Order model. But anyway in my controller Order model returns unfiltered results (checked with dd too). How can I fix this?