Example #1
0
 /**
  * Stores updated options in database.
  * 
  * @return Redirect
  */
 public function postOptions()
 {
     $options = Input::except('_token', '_method');
     if (!$this->validator->setRules('options')->with($options)->passes()) {
         return Redirect::back()->withErrors($this->validator->errors())->withInput($options);
     }
     $this->dashboard->updateOptions($options);
     return Redirect::back()->withSuccess(trans('dash.options update success'));
 }
 /**
  * Stores updated options in database.
  * 
  * @return Redirect
  */
 public function options()
 {
     $options = Input::except('_token', '_method');
     foreach ($options as $i => $option) {
         if (is_array($option)) {
             $options[$i] = json_encode($option);
         }
     }
     if (!$this->validator->setRules('options')->with($options)->passes()) {
         return Redirect::back()->withErrors($this->validator->errors())->withInput($options);
     }
     $this->dashboard->updateOptions($options);
     Cache::flush();
     if (Request::ajax()) {
         return Response::json(trans('dash.options update success'), 200);
     } else {
         return Redirect::back()->withSuccess(trans('dash.options update success'));
     }
 }