Yes, this can be done using a combination of with calls and whereIn method. Here's an example code snippet that should work:
$ingredientName = 'tomato';
$recipes = Recipe::whereHas('ingredients', function ($query) use ($ingredientName) {
$query->where('name', $ingredientName);
})->with(['ingredients' => function ($query) use ($ingredientName) {
$query->where('name', '!=', $ingredientName);
}])->get();
This code will retrieve all recipes that use the given ingredient name, and for each recipe, it will also retrieve the list of all other ingredients used in that recipe. The whereHas method is used to filter the recipes based on the given ingredient name, and the with method is used to eager load the related ingredients for each recipe. The nested where clause inside the with method is used to exclude the given ingredient from the list of related ingredients.