ldc-nature-and-respect/app/Http/Controllers/Fo/RecipeController.php
2023-05-04 11:26:14 +02:00

36 lines
927 B
PHP

<?php
namespace App\Http\Controllers\Fo;
use App\Http\Controllers\Controller;
use App\Models\Recipe;
class RecipeController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Contracts\View\View
*/
public function index()
{
// Get recipies.
$recipes = Recipe::where('status', true)->get();
// Filter poultry.
$poultries = $recipes->unique('range_id')->pluck('range_id');
// Filter difficulty.
$difficulties = $recipes->unique('difficulty')->pluck('difficulty');
return view('fo.pages.recipes.index', compact(['recipes', 'poultries', 'difficulties']));
}
/**
* Recipe show
*
* @param Recipe $recipe
* @return \Illuminate\Contracts\View\View
*/
public function show(Recipe $recipe)
{
return view('fo.pages.recipes.show', ['recipe' => $recipe]);
}
}