<?php
namespace TPS\Shop\Http\Controllers;
use Illuminate\Http\Request;
use TPS\Shop\Repositories\ProductRepository;
use Webkul\Shop\Http\Controllers\Controller;


class ShopController extends Controller
{
    /**
     * Loads the home page for the storefront.
     *
     * @return \Illuminate\View\View
     */

    public function __construct(
        protected ProductRepository $productRepository,
    )
    {
        $this->_config = request('_config');
    }

    public function search(Request $request)
    {
        $results = $this->productRepository->searchProductByAttribute($request->input());

        return view('shop::search.search')->with('results', $results ?: null);
    }
}
