2018-08-03 14:50:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Webkul\Shop\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Http\Response;
|
|
|
|
|
use Illuminate\Routing\Controller;
|
|
|
|
|
use Webkul\Channel\Channel;
|
|
|
|
|
use Webkul\Core\Repositories\SliderRepository as Slider;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Slider controller
|
|
|
|
|
*
|
|
|
|
|
* @author Prashant Singh <prashant.singh852@webkul.com>
|
|
|
|
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class SliderController extends controller
|
|
|
|
|
{
|
|
|
|
|
protected $_config;
|
2018-08-08 13:47:40 +00:00
|
|
|
protected $slider;
|
|
|
|
|
protected $channels;
|
2018-08-03 14:50:13 +00:00
|
|
|
|
2018-08-08 13:47:40 +00:00
|
|
|
public function __construct(Slider $slider)
|
2018-08-03 14:50:13 +00:00
|
|
|
{
|
2018-08-08 13:47:40 +00:00
|
|
|
$this->slider = $slider;
|
2018-08-03 14:50:13 +00:00
|
|
|
$this->_config = request('_config');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-08 13:47:40 +00:00
|
|
|
/**
|
|
|
|
|
* Loads the index
|
|
|
|
|
* for the sliders
|
|
|
|
|
* settings.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public function index() {
|
|
|
|
|
return view($this->_config['view']);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Loads the form
|
|
|
|
|
* for creating
|
|
|
|
|
* slider.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public function create() {
|
2018-08-03 14:50:13 +00:00
|
|
|
$call = new Channel();
|
2018-08-09 12:00:26 +00:00
|
|
|
$channels = $call->getAllChannels();
|
2018-08-03 14:50:13 +00:00
|
|
|
return view($this->_config['view'])->with('channels',[$channels]);
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-08 13:47:40 +00:00
|
|
|
/**
|
|
|
|
|
* Creates the new
|
|
|
|
|
* sider item
|
|
|
|
|
*/
|
|
|
|
|
public function store() {
|
|
|
|
|
$this->slider->create(request()->all());
|
2018-08-09 12:00:26 +00:00
|
|
|
session()->flash('success', 'Slider created successfully.');
|
2018-08-08 13:47:40 +00:00
|
|
|
return redirect()->back();
|
2018-08-03 14:50:13 +00:00
|
|
|
}
|
|
|
|
|
}
|