ldc-wenn-dann-mit-respekt/app/Http/Controllers/Fo/RecipeController.php

36 lines
894 B
PHP
Raw Permalink 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;
2023-05-04 19:08:24 +02:00
use Illuminate\Contracts\Database\Eloquent\Builder;
class RecipeController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Contracts\View\View
*/
public function index()
{
2023-05-04 19:08:24 +02:00
$recipes = Recipe::query()->where('status', true)
->whereHas('range', fn (Builder $q) => $q->where('status', true))
2023-05-05 07:52:58 +02:00
->orderBy('order')
2023-05-04 19:08:24 +02:00
->get();
2023-05-05 07:52:58 +02:00
return view('fo.pages.recipes.index', compact('recipes'));
}
/**
* 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]);
}
}