This is not related to Laravel. You‘re selecting non-aggregated columns (*) in combination with grouping.
You have two options here
- use aggregation (Min, Max, Avg, Group_concat) on each column you‘re selecting and not grouping by
- disable ONLY_FULL_GROUP_BY on the MySQL server
More detailed explanation
https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
Edit:
Apparently Laravel can set MySQL modes on the fly as well.
As mentioned in the comments, you can disable strict mode in the Laravel database settings, Laravel then should set the MySQL server mode accordingly, I don’t find up-to-date documentation for this tho
https://github.com/laravel/laravel/blob/master/config/database.php#L59
https://mattstauffer.com/blog/strict-mode-and-other-mysql-customizations-in-laravel-5-2/
make sure you clear any config cache after changing the setting