eloquent get the customer with multiple times order... hi all..(to the point)
i have 2 tables:
model customer hasMany order.
how to get the top ten customer who has multiple time ordering?
thanks for your support..
The simplest would be something like
Customers::withCount('orders')->orderBy('order_count', 'desc')->limit(10)->get();
@Tray2 awesome..thanks for direct answer. sorry for newbe question..im just two weeks with laravel. i dont know laravel has built in method for count XD...
@paklie If you feel that @tray2 answer helps you, please mark that answer as the best reply to solve this question.
@paklie It's unfair!
You must choose @tray2 response as a BEST ANSWER , not mine.
I didn't provide any solution for you.
Please sign in or create an account to participate in this conversation.