with laravel with whre 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();