protected function validateIfDesired(array $input, AppliesToResource $resource=null, $locale=null)
    {

        if (!$this->shouldValidate) {
            return true;
        }

        $validator = $this->validator ? $this->validator : $this->validatorFactory->make($this->validationRules, $resource);

        if (!$validator) {
            throw new MisConfiguredException("Cannot validate without a validator or rules");
        }

        $this->callBeforeListeners('validate', [$input, $resource, $locale]);
        $validator->validate($input, $resource, $locale);
        $this->callAfterListeners('validate', [$input, $resource, $locale]);

        return true;

    }
protected function validateIfDesired(array $input, AppliesToResource $resource=null, $locale=null)
    {

        if (!$this->shouldValidate) {
            return true;
        }

        $validator = $this->validator ? $this->validator : $this->validatorFactory->make($this->validationRules, $resource);

        if (!$validator) {
            throw new MisConfiguredException("Cannot validate without a validator or rules");
        }

        $this->callBeforeListeners('validate', [$input, $resource, $locale]);
        $validator->validate($input, $resource, $locale);
        $this->callAfterListeners('validate', [$input, $resource, $locale]);

        return true;

    }
protected function validateIfDesired ( array $ input , AppliesToResource $ resource = null , $ locale = null ) { if ( ! $ this -> shouldValidate ) { return true ; } $ validator = $ this -> validator ? $ this -> validator : $ this -> validatorFactory -> make ( $ this -> validationRules , $ resource ) ; if ( ! $ validator ) { throw new MisConfiguredException ( "Cannot validate without a validator or rules" ) ; } $ this -> callBeforeListeners ( 'validate' , [ $ input , $ resource , $ locale ] ) ; $ validator -> validate ( $ input , $ resource , $ locale ) ; $ this -> callAfterListeners ( 'validate' , [ $ input , $ resource , $ locale ] ) ; return true ; }
Validate if validate is on.

@array $input

@return bool
Validate if validate is on .