Skip to content

Instantly share code, notes, and snippets.

@guillermoprojaslema
Created October 24, 2017 20:54
Show Gist options
  • Save guillermoprojaslema/f58a566f0bad61366fbe49c402060654 to your computer and use it in GitHub Desktop.
Save guillermoprojaslema/f58a566f0bad61366fbe49c402060654 to your computer and use it in GitHub Desktop.
$query_properties = Property::whereBetween('price', [$prices[0], $prices[1]])
->where('property_type', $request->property_type)
->get();
$query_properties->filter(function ($property, $request) {
if ($property->building_id) {
return $property->building->neighborhood->place->city->state->id == $request->state_id;
} else {
return $property->neighborhood->place->city->state->id == $request->state_id;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment