@dadub remove year_id from fillable fields (also you can simplify years relationship declaration as far as you follow conventions)
class Evenement extends Model
{
protected $fillable = ['name', 'mnemonique','color'];
public function years()
{
return $this->belongsToMany(Year::class);
}
}
and then in controller
$evenement = Evenement::create($validatedData);
$evenement->years()->sync([$validatedData['year_id']]);
Also (as far as event can have maany years, you need to change your form to accept many year_id, change in validation
'year_id' => 'required|array',
'year_id.*' => 'required|integer|exists:years,id',
and in controller
$evenement = Evenement::create($validatedData);
$evenement->years()->sync($validatedData['year_id']);