In%%, all routes must pass through the middleware group called Laravel 5.2
.
What happens is that in some releases of web
, the Laravel 5.2
settings are as follows:
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace, 'middleware' => 'web'], function ($router) {
require app_path('Http/routes.php');
});
}
Note that it has already been stated there that all routes you create within RouteServiceProvider
will have the settings set in Http/routes.php
. In your case, we have verified that it is so, so when you have made your $router->group
statement, you are causing this ['middleware' => ['web','auth']
to be processed again.
Incredibly, the Middleware middleware
group is responsible for session preprocessing.
When you talk about "no error is being displayed," you're probably talking about validation errors, which use web
, which in turn use MessageBag
.
The Session Flash
is created only once, and when it is accessed, it is removed. If you call Flash
twice because of redreaction, it is obvious that on the second call middleware
will no longer exist.
So the solution to your problem is simply to remove% with% from your Session Flash
, thus:
['middleware' => ['auth']
So we have been able to solve the problem.
It is worth mentioning that in some versions of web
, this method does not come with the web middleware, being necessary to add either the Route Group declaration or the RouteServiceProvider declaration.
In my project for example, it looks like this:
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function ($router) {
require app_path('Http/routes.php');
});
}