Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel Method Illuminate\Validation\Validator::validateRequest does not exist

when i submit a form and run form validation then it gaves me this error but my form validation is working on other page In that file \vendor\laravel\framework\src\Illuminate\Validation\Validator.php

/**
 * Handle dynamic calls to class methods.
 *
 * @param  string  $method
 * @param  array   $parameters
 * @return mixed
 *
 * @throws \BadMethodCallException
 */
public function __call($method, $parameters)
{
    $rule = Str::snake(substr($method, 8));

    if (isset($this->extensions[$rule])) {
        return $this->callExtension($rule, $parameters);
    }

    throw new BadMethodCallException(sprintf(
        'Method %s::%s does not exist.', static::class, $method
    ));
}

Errror= Method Illuminate\Validation\Validator::validateRequest does not exist

like image 956
Daniel Masih Avatar asked Apr 24 '18 12:04

Daniel Masih


2 Answers

Maybe you wrote request instead of required? Like here:

$data = $request->validate([
    'field' => 'request|string|max:255',
]);

Trying to fire validateRequest method suggest you were trying to use 'request' validation rule which doesn't exist.

All valid rules you can find here, but I think you just made a typo.

like image 60
Marta Avatar answered Nov 15 '22 05:11

Marta


You should use a Validator facade class

In you Controller

use Validator;

See link Laravel validation

like image 35
aj3sh Avatar answered Nov 15 '22 07:11

aj3sh