Search code examples
phplaravelmiddlewarelaravel-5

web middleware laravel 5.2


I'm trying to use the middleware web, but when I put my route inside it, my project stop working and shows this error

Whoops, looks like something went wrong.

When I remove and use my route outside the middleware web, works again. What could be? (Sorry for my english, it is not my native language).

This works:

Route::get('/contact', 'TicketsController@create');
Route::post('/contact', 'TicketsController@store');

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

});

This not works:

Route::group(['middleware' => ['web']], function () {
    Route::get('/contact', 'TicketsController@create');
    Route::post('/contact', 'TicketsController@store');
});

Solution

  • I found how to solve this

    1. you must generate a key with php artisan key:generate
    2. In config/app.php place generate key' => 'xxxxxxxxxxxxxxxxxx',

    I set true debug property in config/app.php ('debug' => env('APP_DEBUG', true) ) and i see how to fix that