Laravel 5.2 Validation Error not appearing in blade

Use Below line in your controller

use Validator;

Add below code in your controller function where your request is sent.

$validator  =   Validator::make($request->all(), [
     'fname'     =>  'required|max:20|min:4',
     'uemail'    =>  'required|email',
     'message'   =>  'required',
 ]);                                                                                                                                                                                                                               
if ($validator->fails()) {
       $messages = $validator->messages();
       return Redirect::back()->withErrors($messages)->withInput($request->all()); 
 }      

In your view page

 @if ($errors->any())
   <label for="fname" class="error">{{ $errors->first('fname') }}</label> 
 @endif

For display individual field wise error.


Try to remove web middleware if you're using 5.2.27 or higher. The thing is now Laravel automatically applies web middleware to all routes inside routes.php and if you're trying to add it manually you can get errors.

app/Providers/RouteServiceProvider.php of the 5.2.27 version now adds web middleware to all routes inside routes.php:

protected function mapWebRoutes(Router $router)
{
    $router->group([
        'namespace' => $this->namespace, 'middleware' => 'web',
    ], function ($router) {
        require app_path('Http/routes.php');
    });
}