define a where in relation laravel 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();