Relationship Counts
withCount
var post = getInstance( "Post" )
.withCount( "comments" )
.findOrFail( 1 );
post.getCommentsCount();var post = getInstance( "Post" )
.withCount( "comments AS myCommentsCount" )
.findOrFail( 1 );
post.getMyCommentsCount();Last updated
Was this helpful?