$users = User::join('posts', 'posts.user_id', '=', 'users.id')
->where('users.status', 'active')
->where('posts.status','active')
->get(['users.*', 'posts.descrption']);
Event::whereHas('participants', function ($query) {
return $query->where('IDUser', '=', 1);
})->get();
$select->joinSub(
$selectSubQry,
'ag',
'ag.id',
'=',
'agp.userId'
);