如何在laravel中的数据透视表上应用groupBy关键字?

I have pivot table users_logs which has many columns and one of them is event_date. I want to retrieve all data which is associated with particular user. I have done it by I can't use groupBy() keyword because it is returning error.

 $GameLogs = User::with(['gamelogs' => function ($query)
{
    $query->where('type', '=', 'play');
    $query->groupBy('event_date');
}])->find(request()->user()->id);

Can someone kindly guide me how can I fix the issue. I would appreciate. Thank you so much.

Error is

SQLSTATE[42000]: Syntax error or access violation: 1055 'o*******_db.g***s.i`

When you do a groupBy, the selected fields need to be aggregated in strict mode

$GameLogs = User::with(['gamelogs' => function ($query)
    {
        $query->where('type', '=', 'play');
        $query->groupBy('event_date', 'user_id');
        $query->select('event_date', 'user_id');
    }])
    ->find(request()->user()->id);