| xqd
@@ -28,6 +28,59 @@ class SettingsController extends Controller
|
|
|
return view('admin.settings.banner.index',compact('list'));
|
|
|
}
|
|
|
|
|
|
+ public function bannerCreate(Request $reqeust)
|
|
|
+ {
|
|
|
+ if ($reqeust->method() == 'POST') {
|
|
|
+ return $this->_createSave();
|
|
|
+ }
|
|
|
+ return view('admin.settings.banner.edit');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存修改
|
|
|
+ */
|
|
|
+ private function _createSave(){
|
|
|
+ $data = (array) request('data');
|
|
|
+ $id = $this->repository->create($data);
|
|
|
+ if($id) {
|
|
|
+ $url[] = array('url'=>U( 'setting/banner/index'),'title'=>'返回列表');
|
|
|
+ $url[] = array('url'=>U( 'setting/banner/create'),'title'=>'继续添加');
|
|
|
+ $this->showMessage('添加成功',$url);
|
|
|
+ }else{
|
|
|
+ $url[] = array('url'=>U( 'setting/banner/index'),'title'=>'返回列表');
|
|
|
+ return $this->showWarning('添加失败',$url);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * 修改
|
|
|
+ *
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public function bannerUpdate(Request $reqeust) {
|
|
|
+ if($reqeust->method() == 'POST') {
|
|
|
+ return $this->_updateSave();
|
|
|
+ }
|
|
|
+ $data = $this->repository->find($reqeust->get('id'));
|
|
|
+ return view('admin.settings.banner.edit',compact('data'));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存修改
|
|
|
+ */
|
|
|
+ private function _updateSave() {
|
|
|
+ $data = (array) request('data');
|
|
|
+ $ok = $this->repository->update(request('id'),$data);
|
|
|
+ if($ok) {
|
|
|
+ $url[] = array('url'=>U( 'setting/banner/index'),'title'=>'返回列表');
|
|
|
+ return $this->showMessage('操作成功',urldecode(request('_referer')));
|
|
|
+ }else{
|
|
|
+ $url[] = array('url'=>U( 'setting/banner/index'),'title'=>'返回列表');
|
|
|
+ return $this->showWarning('操作失败',$url);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function bannerDestroy(Request $request)
|
|
|
{
|
|
|
$bool = $this->repository->destroy($request->id);
|