The validator function creates a new validator instance with the given arguments. You may use it as an alternative to the Validator facade:
<?php $validator = validator($data, $rules, $messages);
<?php     public function registerRequestValidation()

    {

        Request::macro('validate', function (array $rules, ...$params) {

            return tap(validator($this->all(), $rules, ...$params), function ($validator) {

                if ($this->isPrecognitive()) {

                    $validator->after(Precognition::afterValidationHook($this))

                        ->setRules(