I want to filter all my users who ordered amount of orders in range so
User::where('type','client')
->whereHas('orders',function ($query) use($min_orders,$max_orders){
})
any solution??
I want to filter all my users who ordered amount of orders in range so
User::where('type','client')
->whereHas('orders',function ($query) use($min_orders,$max_orders){
})
any solution??
You could use has()
filter to filter out users with min and max count of associated orders
User::where('type','client')
->has('orders', '>=', $min_orders)
->has('orders', '<=', $max_orders)
->get()