Hey, this is a problem related with the mysql mode.
Go to config\database.php, mysql and set strict to false.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
hi,
I am to retrieve data based on the day using groupBy. But I am getting an error like this
syntax error or access violation: 1055
what I have tried
public function index(){
$ids = Academic::active()->pluck('id');
if(Auth()->user()->getRoleNames() == '["Parent"]')
{
$id = Auth()->user()->Parents_id;
$parent = ParentName::find($id);
$students = $parent->students;
foreach($students as $stu)
{
$classid[] = $stu->class_id;
}
$timetables = DB::table('time_tables')->whereIn('academic_id', $ids)->whereIn('class', $classid)->groupBy('day')->get();
// $timetables = TimeTable::whereIn('academic_id', $ids)->whereIn('class', $classid)->get();
return response()->json($timetables);
}
Mm, if the strict mode is not solving it, you can try to use groupBy after the get to use it as a collection method:
DB::table('time_tables')->whereIn('academic_id', $ids)->whereIn('class', $classid)->get()->groupBy('day');
Please or to participate in this conversation.