protected function failedValidation(Validator $validator)
 {
     if ($this->ajax()) {
         $this->session()->flashInput($this->all());
         $this->session()->flash('errors', $validator->getMessageBag());
     }
     parent::failedValidation($validator);
 }
示例#2
0
 /**
  * @param Request $request
  * @param Router  $router
  *
  * @return array
  */
 protected function processInput(Request $request, Router $router)
 {
     $type = $request->input('type');
     $target = $request->input('target.' . $type);
     $params = null;
     if ($type == Menu::TYPE_ROUTE) {
         // If we got a route type we have to do
         // some preprocessing with the input
         // TODO check the target select input so that we do not have to convert it back everytime
         $target = array_keys($this->prepareRoutes($router))[$target];
         if (array_key_exists($target, $parameter = $request->input('parameters'))) {
             // If we found a parameter map to the given route
             // we store them inside the database.
             $params = $parameter[$target];
         }
     }
     return $request->only(['visible', 'published_at', 'concealed_at']) + ['type' => $type, 'target' => $target, 'parameters' => $params];
 }