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;
|
2018-08-10 09:28:35 +00:00
|
|
|
|
2018-07-12 07:12:48 +00:00
|
|
|
/**
|
2018-08-10 09:28:35 +00:00
|
|
|
* Home page controller
|
2018-07-12 07:12:48 +00:00
|
|
|
*
|
2018-10-26 07:28:38 +00:00
|
|
|
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
2018-07-12 07:12:48 +00:00
|
|
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
|
|
|
|
*/
|
2019-03-20 04:43:27 +00:00
|
|
|
class HomeController extends Controller
|
2018-07-12 07:12:48 +00:00
|
|
|
{
|
|
|
|
|
protected $_config;
|
2019-07-01 11:33:36 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SliderRepository object
|
|
|
|
|
*
|
|
|
|
|
* @var Object
|
|
|
|
|
*/
|
2019-04-18 07:22:51 +00:00
|
|
|
protected $sliderRepository;
|
2018-07-12 07:12:48 +00:00
|
|
|
|
2019-07-01 11:33:36 +00:00
|
|
|
/**
|
|
|
|
|
* Create a new controller instance.
|
|
|
|
|
*
|
|
|
|
|
* @param \Webkul\Core\Repositories\SliderRepository $sliderRepository
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2019-04-18 07:22:51 +00:00
|
|
|
public function __construct(SliderRepository $sliderRepository)
|
2018-07-12 07:12:48 +00:00
|
|
|
{
|
|
|
|
|
$this->_config = request('_config');
|
|
|
|
|
|
2019-04-18 07:22:51 +00:00
|
|
|
$this->sliderRepository = $sliderRepository;
|
2018-07-12 07:12:48 +00:00
|
|
|
}
|
2019-02-14 13:54:44 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* loads the home page for the storefront
|
2019-08-19 09:30:24 +00:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\View\View
|
2019-02-14 13:54:44 +00:00
|
|
|
*/
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
2019-04-18 07:22:51 +00:00
|
|
|
$currentChannel = core()->getCurrentChannel();
|
2019-07-01 11:33:36 +00:00
|
|
|
|
2019-04-18 07:26:36 +00:00
|
|
|
$sliderData = $this->sliderRepository->findByField('channel_id', $currentChannel->id)->toArray();
|
2018-08-09 12:00:26 +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
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* loads the home page for the storefront
|
|
|
|
|
*/
|
|
|
|
|
public function notFound()
|
|
|
|
|
{
|
|
|
|
|
abort(404);
|
|
|
|
|
}
|
2019-04-17 07:26:33 +00:00
|
|
|
}
|