src/Domain/Traits/CheckableTrait.php
protected function applyValidationRules($action, $input = [])
    {
        if ($action == 'read' or $action == 'destroy') {
            return;
        }

        if (! $this->inputValidator) {
            throw new RequiredInputValidatorException('You must provide an inputValidator to perform a data modification / creation');
        }

        $validation = $this->inputValidator->make($input);

        $validation->scope([$action]);

        $validation->bind($validation->getInputs()); // provide all input data for use in rule definitions

        if ($validation->fails()) {
            throw new ValidationException('Validation failed', $validation->errors()->all());
        } else {
            return $validation->getInputs();
        }
    }
protected function applyValidationRules($action, $input = [])
    {
        if ($action == 'read' or $action == 'destroy') {
            return;
        }

        if (! $this->inputValidator) {
            throw new RequiredInputValidatorException('You must provide an inputValidator to perform a data modification / creation');
        }

        $validation = $this->inputValidator->make($input);

        $validation->scope([$action]);

        $validation->bind($validation->getInputs()); // provide all input data for use in rule definitions

        if ($validation->fails()) {
            throw new ValidationException('Validation failed', $validation->errors()->all());
        } else {
            return $validation->getInputs();
        }
    }
protected function applyValidationRules ( $ action , $ input = [ ] ) { if ( $ action == 'read' or $ action == 'destroy' ) { return ; } if ( ! $ this -> inputValidator ) { throw new RequiredInputValidatorException ( 'You must provide an inputValidator to perform a data modification / creation' ) ; } $ validation = $ this -> inputValidator -> make ( $ input ) ; $ validation -> scope ( [ $ action ] ) ; $ validation -> bind ( $ validation -> getInputs ( ) ) ; // provide all input data for use in rule definitions if ( $ validation -> fails ( ) ) { throw new ValidationException ( 'Validation failed' , $ validation -> errors ( ) -> all ( ) ) ; } else { return $ validation -> getInputs ( ) ; } }
Apply validation rules.
@param  string  $action                  Requested action to check
@param  array   $input                   Input data
@throws ValidationException              If input validation fails
@throws RequiredInputValidatorException  If inputValidator is not proivide on a data modification / creation
@return array                            InputFilteredData
Apply validation rules .