Saiiif Saiiif - 1 year ago 107
PHP Question

Form validation is not displaying results on laravel

My form validation was not displaying errors on my

route. I Googled the solution and found that

Route::group(['middleware' => 'web'], function() {

can be changed to

Route::group(['middlewareGroups' => 'web'], function() {

I did that and the problem is solved now. I want to ask if this is considered a good practice to change it like this?

Also if I am removing this line from my routes it is working:

Route::group(['middleware' => 'web'], function() {

Can anyone tell me what is actually happening ?

Answer Source

One reason can be that 'web' middleware is applying two times in your case. Laravel by default adds web Middleware in app/Providers/RoutesServiceProvider.php and agian you are adding it in your routes.php Try it by removing web middleware from your routes.php.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download