ECOMMERCE/app/View/Components/Home/ProductHighlight.php

30 lines
646 B
PHP

<?php
namespace App\View\Components\Home;
use App\Repositories\Catalog\ProductRepository;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class ProductHighlight extends Component
{
public $products;
public function __construct(ProductRepository $productRepository)
{
$params = [
'sort' => 'new',
];
$this->products = $productRepository->getList($params);
}
/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.home.product-highlight');
}
}