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;
|
2018-07-12 07:12:48 +00:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Http\Response;
|
2018-08-09 12:00:26 +00:00
|
|
|
use Webkul\Core\Repositories\SliderRepository as Sliders;
|
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;
|
2018-08-09 12:00:26 +00:00
|
|
|
protected $sliders;
|
|
|
|
|
protected $current_channel;
|
2018-07-12 07:12:48 +00:00
|
|
|
|
2018-08-21 10:58:55 +00:00
|
|
|
public function __construct(Sliders $s)
|
2018-07-12 07:12:48 +00:00
|
|
|
{
|
|
|
|
|
$this->_config = request('_config');
|
2018-08-09 12:00:26 +00:00
|
|
|
$this->sliders = $s;
|
2018-07-12 07:12:48 +00:00
|
|
|
|
|
|
|
|
}
|
2019-02-14 13:54:44 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* loads the home page for the storefront
|
|
|
|
|
*/
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
2018-08-21 10:58:55 +00:00
|
|
|
$current_channel = core()->getCurrentChannel();
|
2018-08-09 12:00:26 +00:00
|
|
|
|
2019-02-14 13:54:44 +00:00
|
|
|
$all_sliders = $this->sliders->findWhere(['channel_id' => $current_channel['id']]);
|
2018-08-09 12:00:26 +00:00
|
|
|
|
2019-02-14 13:54:44 +00:00
|
|
|
return view($this->_config['view'])->with('sliderData', $all_sliders->toArray());
|
2018-07-12 07:12:48 +00:00
|
|
|
}
|
|
|
|
|
}
|