ldc-wenn-dann-mit-respekt/app/View/Components/RecipeCard.php
2022-11-18 12:39:03 +01:00

34 lines
654 B
PHP

<?php
namespace App\View\Components;
use Illuminate\View\Component;
use App\Recipe;
class RecipeCard extends Component
{
public $id;
public $recipe;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct($id)
{
$this->recipe = Recipe::where('id', $id)->first();
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
$recipe = $this->recipe;
return view('components.recipe-card', compact('recipe'));
}
}