Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

withCount laravel assign generic name

$users = User::withCount([
    'posts', 
    'comments', 
    'comments as approved_comments_count' => function ($query) {
        $query->where('approved', 1);
	}
])->get();
 
PREVIOUS NEXT
Tagged: #withCount #laravel #assign #generic
ADD COMMENT
Topic
Name
6+2 =