I just learned laravel, how to use this session?
This will result in an error
Request::session()->put('user', 'test');
Error content: Session store not set on request.
How to solve this?
You should be fine if you update Laravel to 5.2.27 and later versions. Refer to Laravel5.2.27 to automatically add web middleware to each page
The session configuration file is configured in config/session.phpYou can check to see if your configuration is wrong
If you are laravel5.2, when using session status, csrf protection and other functions, you must use the "web" middleware
Route::group(['middleware' => ['web']], function () { // your routes here });
You should be fine if you update Laravel to 5.2.27 and later versions.
Refer to Laravel5.2.27 to automatically add web middleware to each page
The session configuration file is configured in config/session.php
You can check to see if your configuration is wrong
If you are laravel5.2, when using session status, csrf protection and other functions, you must use the "web" middleware