Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.6] Add note for using withCount together with select #4404

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions eloquent-relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ You may also alias the relationship count result, allowing multiple counts on th

echo $posts[0]->pending_comments_count;

> {note} In case of specifying columns selected for your model (using for example `select`) use `withCount` after specifying those columns. Otherwise generated query might be invalid and you might also get invalid counts of related models.

<a name="eager-loading"></a>
## Eager Loading

Expand Down