public function search(Request $request)
{
$result = DB::table('ads')
->where('city', $request->city)
->orWhere('category', $request->cat)
->get();
dd($result);
}
$cityId = $request->input('city_id');
$categoryId = $request->input('category_id');
$adverts = Advert::when($cityId, function ($query, $cityId) {
$query->where('city_id', $cityId);
})
->when($categoryId, function ($query, $categoryId) {
$query->where('category_id', $categoryId);
})
->get();