$streets = (new PropertyStreet)->newQuery();
if ($request->has('street')) {
$streets->where('name', 'like', '%'.$request->street.'%');
}
if ($request->has('house')) {
$streets->whereHas('properties', function ($query) use ($request) {
$query->where('house_number', $request->house);
});
}
return $streets->get();
it gets the street data
I want to do something like this ?street=b-34&house=21 and to display the house data, only as of right now it get's only street.
@MANELGAVALDA - Thank you I did apply that. Is it possible to display the property data after the search, as it just returns the street. such as ?street=b-34&house=21
?street= returns the results of street. What I'm trying to achieve is ?street=1&house=abc, to show only the house related data, but it should be in street 1.