mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 21:34:03 +00:00
13 lines
No EOL
468 B
Markdown
13 lines
No EOL
468 B
Markdown
---
|
|
title: 'Use aggregate methods to count related models'
|
|
tweet_id: '1464247626405060616'
|
|
thread_slug: weekly-thread-2021-47
|
|
author_username: alexjgarrett
|
|
images:
|
|
- 'https://pbs.twimg.com/media/FEy-iNNX0AYjL56.jpg'
|
|
created_at: 2021-11-26T15:00:13+00:00
|
|
slug: 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. |