and my query is
$properties = Properties::where('status', 1)
->when(request()->property_purpose, function ($query) {
$query->where('property_purpose', request()->property_purpose);
})
->when($city, function ($query) {
// city
$query->where('city', request()->city);
})
->when($subcity, function ($query) {
// sub city
$query->where('subcity', request()->subcity);
})->when(request()->get('ameneties'), function($query){
$parts = request('ameneties');
for( $i=0; $i<count($parts); $i++ ) {
$query->WhereRaw( "find_in_set(".$parts[$i]." , properties.property_features)" );
}
})