File: D:/HostingSpaces/SBogers10/blije-gasten.komma.pro/app/Komma/Shop/Products/ProductController.php
<?php
namespace App\Komma\Shop\Products;
use App\Http\Middleware\WildcardResolver;
use App\Komma\Base\Controller;
use App\Komma\Forms\Models\Request;
use App\Komma\Globalization\RegionInfo;
use App\Komma\Globalization\RegionInfoInterface;
use App\Komma\Pages\Models\Page;
use App\Komma\Pages\Models\PageTranslation;
use App\Komma\Routes\Models\Route;
use App\Komma\Shop\Catalog\Kms\SearchService;
use App\Komma\Shop\Categories\Models\Category;
use App\Komma\Shop\Products\Product\Product;
use App\Komma\Shop\Products\Product\ProductTranslation;
use App\Komma\Shop\Vat\VatServiceInterface;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Str;
use Symfony\Component\HttpKernel\Exception\HttpException;
class ProductController extends Controller
{
/**
* @param Product $product
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function show(Product $product)
{
$product->load('translation', 'documents', 'categories', 'categories.translation');
//Get regional information to format prices properly
$regionInfo = app(RegionInfoInterface::class);
//Calculate vat for product
// $rateService = app()->make(VatServiceInterface::class);
// $rateService->calculateVatForProductable($product);
$page = $this->links->products->node;
// Return view
return view('site.templates.products_show',[
'page' => $page,
'product' => $product,
'links' => $this->links,
'headerImageFolder' => 'categories/' . $product->categories->first()->code_name,
'regionInfo' => $regionInfo,
]);
}
/**
* This route is only made for binding the show pages.
* But maybe in the future we could make some thing here.
* For now redirect to the assortment page.
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function index()
{
return redirect($this->links->categories->route);
}
}