예제 #1
0
 /**
  * Retrieve the rules necessary for updating user profile information.
  * This use-case is unique in such that, if the password fields are empty,
  * we don't need to validate them, as the user is not changing their password.
  *
  * @param array $input
  */
 public function __construct(array $input = [])
 {
     parent::__construct($input);
     if ($input['password'] == null || $input['password'] == "") {
         unset($this->rules['password']);
         unset($this->rules['passwordConfirmation']);
     }
 }
예제 #2
0
 /**
  * Validates the rules provided either by a custom method or on the class against the user input provided.
  *
  * @throws ValidationException
  * @return boolean
  */
 public function validate()
 {
     $validator = ValidatorFacade::make($this->getInput(), $this->getRules());
     if ($validator->fails()) {
         throw new ValidationException($validator);
     }
     return true;
 }