MySQL structure
id
key
display_name
value
details
group
created_at
updated_at
Laravel resource index
public function index()
{
$settings = Setting::groupBy('group')->select('id','group as name')->orderBy('id', 'ASC')->get();
return view('settings.general'), compact('settings'));
}
When I run the code its how error :
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'demodb.settings.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select id
, group
as name
from settings
group by group
order by id
asc)