Reputation: 159
This is the error
Symfony \ Component \ Debug \ Exception \ FatalErrorException Call to 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 can this be?
Upvotes: 14
Views: 20886
Reputation: 65
Add this below namespace:
use Illuminate\Support\Facades\Validator;
Upvotes: 6
Reputation: 31
Can you please go to your app/config/app.php and check whether
Illuminate\Validation\ValidationServiceProvider
is available or not.
If not then just add this line and check if the problem is solved or not.
Hope it will help you.
Upvotes: 2
Reputation: 4272
I believe that you probably have
use Illuminate\Validation\Validator;
in your file. (Your IDE probably thought it was being helpful.) To use the static ::
call, Validator
should be aliased to Illuminate\Support\Facades\Validator
. (The \app\config\app.php file does this for you by default.)
Chances are good that changing the use statement to
use \Validator;
will fix things.
Upvotes: 37