public function indexByProduct($productSlug) { $product = Product::live()->where('slug', '=', $productSlug)->first(); if (!$product) { \App::abort(404); } $recipes = Recipe::select('fbf_food_recipes.*')->join('fbf_food_product_recipe', 'fbf_food_recipes.id', '=', 'fbf_food_product_recipe.recipe_id')->join('fbf_food_products', 'fbf_food_product_recipe.product_id', '=', 'fbf_food_products.id')->where('fbf_food_products.slug', '=', $productSlug)->live()->orderBy('fbf_food_recipes.name')->paginate(); return \View::make(\Config::get('laravel-food::views.recipes.index'))->with(compact('product', 'recipes')); }
public function view($productCategorySlug) { $productCategory = ProductCategory::live()->where('slug', '=', $productCategorySlug)->first(); $products = Product::live()->where('product_category_id', '=', $productCategory->id)->orderBy('name', 'asc')->get(); return \View::make(\Config::get('laravel-food::views.product_categories.view'))->with(compact('productCategory', 'products')); }