$result = Category::where('on_off', 1)
->has('product')
->whereHas('product', function ($query) use ($city_one) {
$query->where('on_off', 1)
->whereHas('shop', function ($query) use ($city_one) {
$query->where('on_off', 1)
->whereHas('shop_map_point', function ($query) use ($city_one) {
$query->where('city_id', $city_one->id);
});
});
})
->get();