Why GROUP BY is not working in Laravel 5?

Write request means Laravel. Can't help with the method of GROUP BY.
Here is the MySQL query that works fine in the console:
SELECT users.*, sum(payments.amount) as sum_p 
FROM users as users
LEFT JOIN payments as payments ON payments.user_id=users.id
WHERE payments.amount>0 AND payments.to_user_id=1 AND payments.status='success'
GROUP BY users.ORDER BY id DESC sum_p;

But the version with the interpreter:
User::selectRaw('users.*, SUM(payments.amount) as sum_p')
 ->join("payments", 'payments.user_id', 'users.id')
 ->where('payments.status', 'success')
 ->where('payments.amount', '>', '0')
 ->where('payments.to_user_id', $user->id)
 ->groupBy('users.id')->orderBy('sum_p', 'desc')

Which gives error Syntax error or access violation: 1055 'laravel_project.users.name' isn't in GROUP BY.
But if selectRaw users.* change to user.id (as in groupBy), everything is working fine, but he will, of course, I only two columns: users.id and sum_p, not the User model completely. How to get around that? What I don't understand?
June 14th 19 at 20:27
1 answer
June 14th 19 at 20:29
File /config/database.php, line 53: 'strict' => true, (to "see" 'mysql'), the value to change to false.

Thank you very much. What is it? - lauryn_Simonis commented on June 14th 19 at 20:32
not for that, please.

What is it?
This parameter MySQL'and "mode". Details here. There are some features, including mode "ONLY_FULL_GROUP_BY", which most likely You have "ax" request. - Salvado commented on June 14th 19 at 20:35

Find more questions by tags LaravelMySQL