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`