ldc-wenn-dann-mit-respekt/app/View/Components/RecipeProductStoerer.php

46 lines
835 B
PHP
Raw Normal View History

2022-11-18 12:39:03 +01:00
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use App\Product;
class RecipeProductStoerer extends Component
{
2022-12-23 17:24:09 +00:00
/**
* id variable
*
* @var integer
*/
2022-11-18 12:39:03 +01:00
public $id;
2022-11-18 15:35:39 +01:00
2022-12-23 17:24:09 +00:00
/**
* product variable
*
* @var \App\Product
*/
2022-11-18 12:39:03 +01:00
public $product;
2022-12-23 17:24:09 +00:00
2022-11-18 12:39:03 +01:00
/**
* Create a new component instance.
*
2022-12-23 17:24:09 +00:00
* @param integer $id
2022-11-18 12:39:03 +01:00
* @return void
*/
2022-12-23 17:24:09 +00:00
public function __construct(int $id)
2022-11-18 12:39:03 +01:00
{
2022-12-23 17:24:09 +00:00
$this->product = Product::where('id', $id)->first();
2022-11-18 12:39:03 +01:00
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
$product = $this->product;
return view('components.recipe-product-stoerer', compact('product'));
}
}