ldc-nature-and-respect/app/View/Components/RecipeCard.php

45 lines
803 B
PHP
Raw Permalink Normal View History

2023-04-05 08:44:33 +00:00
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use App\Models\Recipe;
class RecipeCard extends Component
{
/**
* @var integer
*/
public $id;
/**
* Recipe model
*
2024-01-29 16:02:03 +01:00
* @var \App\Models\Recipe
2023-04-05 08:44:33 +00:00
*/
public $recipe;
/**
* Create a new component instance.
*
* @param integer $id
* @return void
*/
public function __construct(int $id)
{
2024-01-29 16:02:03 +01:00
$this->recipe = Recipe::query()->where('id', $id)->first();
2023-04-05 08:44:33 +00:00
}
/**
* 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', compact('recipe'));
}
}