The error message is due to the sql_mode=only_full_group_by setting in MySQL. This setting requires that all columns in the SELECT clause must either be in the GROUP BY clause or be aggregated. In this case, the link column is not in the GROUP BY clause and is not aggregated.
To fix this error, you can either add the link column to the GROUP BY clause or use an aggregate function like MAX or MIN to select a single value for the link column. Here's an example of using MAX:
$schedules = DB::table('schedules')
->join('events', 'schedules.event_id', '=', 'events.id')
->join('users', 'schedules.user_id', '=', 'users.id')
->where('schedules.user_id', '=', Auth::id())
->select(DB::raw('DATE(schedules.created_at) as date'), DB::raw('MAX(schedules.link) as link'))
->groupBy('date')
->get();
return $schedules;
In this example, we're using MAX to select the maximum value of the link column for each group. This satisfies the requirement of the only_full_group_by setting.