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

37 lines
980 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 16:00:15 +02:00
$recipes = Recipe::query()->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-05-04 16:00:15 +02:00
* @param \App\Models\Recipe $publishedRecipe
* @return \Illuminate\Contracts\View\View
*/
2023-05-04 16:00:15 +02:00
public function show(Recipe $publishedRecipe)
{
2023-05-04 16:00:15 +02:00
return view('fo.pages.recipes.show', ['recipeModel' => $publishedRecipe]);
}
}