ldc-wenn-dann-mit-respekt/app/View/Components/RecipeCard.php
Vincent BRIDIER 2aa73fa32c Clean + CI/CD
2022-12-23 17:24:09 +00:00

44 lines
777 B
PHP

<?php
namespace App\View\Components;
use Illuminate\View\Component;
use App\Recipe;
class RecipeCard extends Component
{
/**
* @var integer
*/
public $id;
/**
* Recipe model
*
* @var \App\Recipe
*/
public $recipe;
/**
* Create a new component instance.
*
* @param integer $id
* @return void
*/
public function __construct(int $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'));
}
}