HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/douven.komma.pro/app/KommaApp/Shop/Products/ProductController.php
<?php

namespace App\KommaApp\Shop\Products;

use App\Http\Controllers\Controller;
use App\KommaApp\Shop\Catalog\Kms\CatalogService;
use App\KommaApp\Shop\Products\Product\Product;

class ProductController extends Controller
{
    private $pagePrefix = 'shop.pages.products.';
    private $catalogService;

    public function __construct(CatalogService $catalogService)
    {
        parent::__construct();
        $this->catalogService = $catalogService;
    }

    /**
     * @return \Illuminate\Contracts\View\View
     */
    public function index()
    {
        $page = $this->pageService->getPageByCodeName('products');


        $allItems = $this->catalogService->getAllItems();

        // Return view
        return \View::make($this->pagePrefix.'index',[
            'page' => $page,
            'links' => $this->links,
            'items' => $allItems,
            'categoryTree' => $this->categoryTree,
        ]);
    }

    /**
     * @return \Illuminate\Contracts\View\View
     */
    public function filters()
    {
        // filter do not apply here
        \App::abort(404);
    }


    /**
     * @param Page $page
     * @return \Illuminate\Contracts\View\View
     */
    public function show(Product $product)
    {
        $product->load(['translation', 'categories' => function($query) {
            $query->with(['translations']); // => function($query) { $query->with('routes'); }]);
        }]);

        $categoryID =

        $page = $this->pageService->getPageByCodeName('products');
        $otherProducts = $this->catalogService->getAllItems()->take(2);

        // Return view
        return \View::make($this->pagePrefix.'show',[
            'page' => $page,
            'product' => $product,
            'links' => $this->links,
            'categoryTree' => $this->categoryTree,
            'otherProducts' => $otherProducts,
        ]);
    }

}