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