Answer the question
In order to leave comments, you need to log in
How can I make a query so that it would be possible to display the number of rows in a loop?
concocted a request:
$user = DB::table('users')
->join('users_group', 'users.id_user_group', '=', 'users_group.id_user_group')
->join('posts', 'users.id', '=', 'posts.id_user')
->select('users.*', 'users_group.group_name', 'posts.id')
->orderby('created_at','asc')
->paginate(10);
Answer the question
In order to leave comments, you need to log in
Use "relationships" for this. Personally, I use them. And then break into a stake. posts and display what you need
$users = DB::table('users')->count();
https://laravel.com/docs/5.4/queries#Aggregates
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question