36 lines
980 B
PHP
36 lines
980 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::query()->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 \App\Models\Recipe $publishedRecipe
|
|
* @return \Illuminate\Contracts\View\View
|
|
*/
|
|
public function show(Recipe $publishedRecipe)
|
|
{
|
|
return view('fo.pages.recipes.show', ['recipeModel' => $publishedRecipe]);
|
|
}
|
|
}
|