37 lines
835 B
PHP
37 lines
835 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Items;
|
|
use App\Repositories\Catalog\ProductRepository;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ProductController extends Controller
|
|
{
|
|
public function detail($slug, Request $request, ProductRepository $productRepository)
|
|
{
|
|
|
|
$product = Items::where('slug', $slug)->first();
|
|
|
|
if ($product == null) {
|
|
abort(404);
|
|
}
|
|
|
|
|
|
$complete_look_products_data = $productRepository->getList([
|
|
'category_id' => $product->category1_id,
|
|
'limit' => 4,
|
|
]);
|
|
|
|
|
|
|
|
$complete_look_products = collect($complete_look_products_data->items())->chunk(2);
|
|
|
|
|
|
return view('shop.product-fashion',[
|
|
'product' => $product,
|
|
'complete_look_products' => $complete_look_products
|
|
]);
|
|
}
|
|
}
|