Skip to content

Commit d624e1d

Browse files
authored
update docs whereHas with count logics
1 parent 1c4936e commit d624e1d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

eloquent-relationships.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,11 @@ If you need even more power, you may use the `whereHas` and `orWhereHas` methods
792792
$posts = App\Post::whereHas('comments', function ($query) {
793793
$query->where('content', 'like', 'foo%');
794794
})->get();
795+
796+
// Retrieve all posts with at least ten comment containing words like foo%
797+
$posts = App\Post::whereHas('comments', function ($query) {
798+
$query->where('content', 'like', 'foo%');
799+
}, '>=', 10)->get();
795800

796801
<a name="querying-relationship-absence"></a>
797802
### Querying Relationship Absence

0 commit comments

Comments
 (0)