eloquent with relation as code example
Example: laravel where on relation
Event::whereHas('participants', function ($query) {
$query->where('IDUser', '=', 1);
})->get();
Event::whereHas('participants', function ($query) {
$query->where('IDUser', '=', 1);
})->get();