final public function validate(array $data, $rules, string $type = null)
    {
        try {
            $this->setMessages($rules);
        } catch (\TypeError $e) {
        }
        try {
            $this->setCustomAttributes($rules);
        } catch (\TypeError $e) {
        }

        try {
            $validator = app('validator')->make(
                array_filter($data),
                $rules->getRules($type),
                $this->messages,
                $this->customAttributes
            );

            $this->validating($validator, $rules, $type);
        } catch (\TypeError $e) {
        }

        if (isset($validator) && $validator->fails()) {
            throw new ValidationException($validator);
        }
    }
final public function validate(array $data, $rules, string $type = null)
    {
        try {
            $this->setMessages($rules);
        } catch (\TypeError $e) {
        }
        try {
            $this->setCustomAttributes($rules);
        } catch (\TypeError $e) {
        }

        try {
            $validator = app('validator')->make(
                array_filter($data),
                $rules->getRules($type),
                $this->messages,
                $this->customAttributes
            );

            $this->validating($validator, $rules, $type);
        } catch (\TypeError $e) {
        }

        if (isset($validator) && $validator->fails()) {
            throw new ValidationException($validator);
        }
    }
final public function validate ( array $ data , $ rules , string $ type = null ) { try { $ this -> setMessages ( $ rules ) ; } catch ( \ TypeError $ e ) { } try { $ this -> setCustomAttributes ( $ rules ) ; } catch ( \ TypeError $ e ) { } try { $ validator = app ( 'validator' ) -> make ( array_filter ( $ data ) , $ rules -> getRules ( $ type ) , $ this -> messages , $ this -> customAttributes ) ; $ this -> validating ( $ validator , $ rules , $ type ) ; } catch ( \ TypeError $ e ) { } if ( isset ( $ validator ) && $ validator -> fails ( ) ) { throw new ValidationException ( $ validator ) ; } }
Validates data.

@param array $data
@param Validation\CustomAttributes|Validation\Messages|Validation\Rules|Validation\Validating $rules
@param string $type
@throws ValidationException
Validates data .