Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

ammannbe/RecipeManager

37 stars
1 code files
View ammannbe/RecipeManager on GitHub

app/Http/Controllers/Ingredients/IngredientController.php

Open in GitHub
use Illuminate\Http\Request;
use App\Models\Recipes\Recipe;
 
class IngredientController extends Controller
{
public function index(Request $request, Recipe $recipe)
{
$this->authorize([Ingredient::class, $recipe]);
$ingredients = $recipe
->ingredients()
->orderBy('ingredient_group_id')
->orderBy('position')
->originalOnly()
->get();
 
if ($request->grouped) {
return $ingredients->groupBy('ingredient_group_id');
}
 
return $ingredients;
}
//
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.