In writing a custom query that returns users with their posts grouped and a count with the total posts made by them
query in SQL
SELECT users.nameUser, COUNT(posts.namePost) AS Total, GROUP_CONCAT(posts.namePost) AS List
FROM users
JOIN posts ON users.id = posts.user_id
GROUP BY users.nameUser;
+----------+-------+-----------------------+
| nameUser | Total | List |
+----------+-------+-----------------------+
| alfa | 2 | PHP 7,Aire comprimido |
| beta | 2 | HTML 5,MySQL 8 |
+----------+-------+-----------------------+
The question is, how can build this query with Eloquent Laravel or even with it query Builder?