45 lines
798 B
PHP
45 lines
798 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\View\Components;
|
||
|
|
|
||
|
|
use Illuminate\View\Component;
|
||
|
|
use App\Models\Recipe;
|
||
|
|
|
||
|
|
class RecipeCardSmall 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('fo.components.recipe-card-small', compact('recipe'));
|
||
|
|
}
|
||
|
|
}
|