Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel hasmany count

/*If you want to count multiple relationships you can provide an array to 
the "withCount" method.*/

$post = Post::withCount(['comments', 'likes'])->first();
Source by postsrc.com #
 
PREVIOUS NEXT
Tagged: #laravel #hasmany #count
ADD COMMENT
Topic
Name
1+9 =