2018-07-12 07:12:48 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Webkul\Shop\Http\Controllers;
|
|
|
|
|
|
2018-10-28 13:23:20 +00:00
|
|
|
use Webkul\Shop\Http\Controllers\Controller;
|
2019-04-18 07:22:51 +00:00
|
|
|
use Webkul\Core\Repositories\SliderRepository;
|
2020-06-11 13:04:16 +00:00
|
|
|
use Webkul\Product\Repositories\SearchRepository;
|
2018-08-10 09:28:35 +00:00
|
|
|
|
2020-06-11 13:04:16 +00:00
|
|
|
class HomeController extends Controller
|
2018-07-12 07:12:48 +00:00
|
|
|
{
|
2019-07-01 11:33:36 +00:00
|
|
|
/**
|
2021-06-16 06:34:54 +00:00
|
|
|
* Slider repository instance.
|
2019-07-01 11:33:36 +00:00
|
|
|
*
|
2020-03-05 13:37:08 +00:00
|
|
|
* @var \Webkul\Core\Repositories\SliderRepository
|
2021-06-16 06:34:54 +00:00
|
|
|
*/
|
2019-04-18 07:22:51 +00:00
|
|
|
protected $sliderRepository;
|
2018-07-12 07:12:48 +00:00
|
|
|
|
2020-06-11 13:04:16 +00:00
|
|
|
/**
|
2021-06-16 06:34:54 +00:00
|
|
|
* Search repository instance.
|
2020-06-11 13:04:16 +00:00
|
|
|
*
|
|
|
|
|
* @var \Webkul\Core\Repositories\SearchRepository
|
2021-06-16 06:34:54 +00:00
|
|
|
*/
|
2020-06-11 13:04:16 +00:00
|
|
|
protected $searchRepository;
|
|
|
|
|
|
2019-07-01 11:33:36 +00:00
|
|
|
/**
|
|
|
|
|
* Create a new controller instance.
|
|
|
|
|
*
|
2020-03-05 13:37:08 +00:00
|
|
|
* @param \Webkul\Core\Repositories\SliderRepository $sliderRepository
|
2020-06-11 13:04:16 +00:00
|
|
|
* @param \Webkul\Product\Repositories\SearchRepository $searchRepository
|
2019-07-01 11:33:36 +00:00
|
|
|
* @return void
|
2021-06-16 06:34:54 +00:00
|
|
|
*/
|
2020-06-11 13:04:16 +00:00
|
|
|
public function __construct(
|
|
|
|
|
SliderRepository $sliderRepository,
|
|
|
|
|
SearchRepository $searchRepository
|
2021-06-16 06:34:54 +00:00
|
|
|
) {
|
2019-04-18 07:22:51 +00:00
|
|
|
$this->sliderRepository = $sliderRepository;
|
2020-02-06 11:48:51 +00:00
|
|
|
|
2020-06-11 13:04:16 +00:00
|
|
|
$this->searchRepository = $searchRepository;
|
|
|
|
|
|
2020-02-06 11:48:51 +00:00
|
|
|
parent::__construct();
|
2018-07-12 07:12:48 +00:00
|
|
|
}
|
2019-02-14 13:54:44 +00:00
|
|
|
|
|
|
|
|
/**
|
2021-06-16 06:34:54 +00:00
|
|
|
* Loads the home page for the storefront.
|
2021-03-19 14:37:58 +00:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\View\View
|
2019-02-14 13:54:44 +00:00
|
|
|
*/
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
2021-06-16 06:34:54 +00:00
|
|
|
$sliderData = $this->sliderRepository->getActiveSliders();
|
2021-03-19 14:37:58 +00:00
|
|
|
|
2019-04-18 07:22:51 +00:00
|
|
|
return view($this->_config['view'], compact('sliderData'));
|
2018-07-12 07:12:48 +00:00
|
|
|
}
|
2019-04-23 07:13:42 +00:00
|
|
|
|
|
|
|
|
/**
|
2021-06-16 06:34:54 +00:00
|
|
|
* Loads the home page for the storefront if something wrong.
|
2021-03-19 14:37:58 +00:00
|
|
|
*
|
2020-03-05 13:37:08 +00:00
|
|
|
* @return \Exception
|
2019-04-23 07:13:42 +00:00
|
|
|
*/
|
|
|
|
|
public function notFound()
|
|
|
|
|
{
|
|
|
|
|
abort(404);
|
|
|
|
|
}
|
2020-06-11 13:04:16 +00:00
|
|
|
|
|
|
|
|
/**
|
2021-06-16 06:34:54 +00:00
|
|
|
* Upload image for product search with machine learning.
|
2020-06-11 13:04:16 +00:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
|
*/
|
|
|
|
|
public function upload()
|
|
|
|
|
{
|
2021-06-16 06:34:54 +00:00
|
|
|
return $this->searchRepository->uploadSearchImage(request()->all());
|
2020-06-11 13:04:16 +00:00
|
|
|
}
|
2021-06-16 06:34:54 +00:00
|
|
|
}
|