More readable now no ?
@foreach($ingredients as $ingredientId => $ingredientTitle)
<input
class="form-check-input"
type="checkbox"
id="ingredient_id"
value="{{ $ingredientId }}"
name="ingredients[]" {{ array($ingredientId, old('ingredients', $alimentaire->ingredient ? $alimentaire->ingredient->pluck('id')->toArray() : [])) ? 'checked' : '' }}
> {{ $ingredientTitle }}
@endforeach
When you write @foreach($ingredients as $ingredientId => $ingredientTitle), be careful, what you are naming $ingredientId isn't the ingredient id, but only the index of the item in the loop.