Example #1
0
 /**
  * Abstracts Laravel's Validator::make()
  *
  * @param array $input Array of input data
  *
  * @return boolean
  */
 public function validate($input)
 {
     $messages = isset(static::$messages) ? static::$messages : array();
     $validator = V::make($input, static::$rules, $messages);
     if ($validator->fails()) {
         $this->errors = $validator->messages();
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * Handle an error with page update
  *
  * @param  InstanceInterface $instance
  * @param  Validator      $validator
  * @return Redirect::route
  */
 public function updateFailed(InstanceInterface $instance, Validator $validator)
 {
     return Redirect::route('pages.edit', $instance->identity())->withInput()->withErrors($validator->errors())->with('message', 'Oops, there was an error');
 }