Laravel Validation Error

This is mistake

Symfony \ Component \ Debug \ Exception \ FatalErrorException Calling the undefined method Illuminate \ Validation \ Validator :: make ()

This is my code.

$validator = Validator::make($userdata,$rules); if( $validator->fails() ) { return View::make('default::partials.user.getregistration')->withErrors($validator)->withInput(); } 

What could it be?

+6
source share
2 answers

I believe that you probably have

 use Illuminate\Validation\Validator; 

in your file. (Your IDE probably thought this was useful.) To use the static call :: , the Validator must be flattened to Illuminate\Support\Facades\Validator . (The file \ app \ config \ app.php does this for you by default.)

It’s likely that changing the usage statement to

 use \Validator; 

will correct the situation.

+13
source

Can you plz go to your app / config / app.php and check if 'Light \ Validation \ ValidationServiceProvider' is available or not. If you do not just add this line and check if the problem is resolved or not. Hope this helps you.

+2
source

Source: https://habr.com/ru/post/971099/


All Articles