->with()->where laravel

PHP
Event::whereHas('participants', function ($query) {
    $query->where('IDUser', '=', 1);
})->get();
Source

Also in PHP: