public function getFilter(Request $request)
 {
     if ($request->ajax()) {
         $id = $_POST['id'];
         $savedFilters = Saved_Search::where('saved_search_id', '=', $id)->get();
         return response()->json(['data' => $savedFilters]);
     }
 }
 public function getSearchListings($searchId)
 {
     $search = Saved_Search::where('saved_search_id', '=', $searchId)->first();
     $topPrice = $search->price_monthly_max;
     if ($topPrice == 2000) {
         $topPrice = 5000000;
     }
     $listings = Listing_Info::whereIfNotNull('num_bedrooms_total', "=", $search->num_bedrooms_total)->whereIfNotNull('price_monthly', "<=", $search->price_monthly_min)->whereIfNotNull('price_monthly', ">=", $topPrice)->whereIfNotNull('num_bathrooms_total', "=", $search->num_bathrooms_total)->whereIfNotNull('has_laundry', "=", $search->has_laundry)->whereIfNotNull('owner_pays_internet', "=", $search->owner_pays_internet)->whereIfNotNull('has_kitchen', "=", $search->has_kitchen)->whereIfNotNull('owner_pays_electricity', "=", $search->owner_pays_electricity)->whereIfNotNull('owner_pays_water', "=", $search->owner_pays_water)->whereIfNotNull('owner_has_pets', "=", $search->owner_has_pets)->whereIfNotNull('allowed_dogs', "=", $search->allowed_dogs)->whereIfNotNull('allowed_cats', "=", $search->allowed_cats)->whereIfNotNull('allowed_other_pets', "=", $search->allowed_other_pets)->get();
     return view('listingBySearch', compact('listings'));
 }