ldc-nature-and-respect/app/Http/Controllers/Fo/RecipeController.php

37 lines
927 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\Fo;
2023-04-05 09:46:24 +00:00
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.
2023-05-04 11:26:14 +02:00
$recipes = Recipe::where('status', true)->get();
// Filter poultry.
2023-04-05 09:46:24 +00:00
$poultries = $recipes->unique('range_id')->pluck('range_id');
// Filter difficulty.
$difficulties = $recipes->unique('difficulty')->pluck('difficulty');
2023-04-05 09:46:24 +00:00
return view('fo.pages.recipes.index', compact(['recipes', 'poultries', 'difficulties']));
}
/**
* Recipe show
*
2023-04-21 10:22:34 +00:00
* @param Recipe $recipe
* @return \Illuminate\Contracts\View\View
*/
2023-04-21 10:22:34 +00:00
public function show(Recipe $recipe)
{
2023-05-04 11:26:14 +02:00
return view('fo.pages.recipes.show', ['recipe' => $recipe]);
}
}