1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00
laravel-tips/content/tips/use-aggregate-methods-to-count-related-models.md
2021-11-26 16:21:56 +01:00

468 B

title tweet_id thread_slug author_username images created_at slug
Use aggregate methods to count related models 1464247626405060616 weekly-thread-2021-47 alexjgarrett
https://pbs.twimg.com/media/FEy-iNNX0AYjL56.jpg
2021-11-26T15:00:13+00:00 use-aggregate-methods-to-count-related-models

When you're counting related models in @laravelphp, opt for aggregates!

👎 Using the count() method on a collection of related models is a tad slower.