Laravel 5.4 Sentinel 会话不会持续
Laravel 5.4 Sentinel session does not persist
<?php
Route::group(['middleware' => ['web'],'namespace' => 'App\Modules\Ministries\Http\Controllers'], function () {
Route::get('ny/ministries/index', array('uses' => 'MinistriesController@getIndex', 'as' => 'admin.ministries.index'));
Route::get('ny/ministries/data', array('uses' => 'MinistriesController@getData', 'as' => 'admin.ministries.data'));
Route::get('ny/ministries/show/{id}', array('uses' => 'MinistriesController@getView', 'as' => 'admin.ministries.view'));
Route::post('ny/ministries/store/', array('uses' => 'MinistriesController@postNew', 'as' => 'admin.ministries.new'));
Route::post('ny/ministries/bulk/', array('uses' => 'MinistriesController@postBulkUpload', 'as' => 'admin.ministries.post'));
});
身份验证工作正常,但是当我尝试 Sentinel::check();当前登录用户返回的值为空
将此添加到 Http 文件夹
中的受保护中间件数组Kernel.php
\Illuminate\Session\Middleware\StartSession::class
然后在下面注释掉,因为你没有使用 laravels 默认的授权功能
\Illuminate\Session\Middleware\AuthenticateSession::class
<?php
Route::group(['middleware' => ['web'],'namespace' => 'App\Modules\Ministries\Http\Controllers'], function () {
Route::get('ny/ministries/index', array('uses' => 'MinistriesController@getIndex', 'as' => 'admin.ministries.index'));
Route::get('ny/ministries/data', array('uses' => 'MinistriesController@getData', 'as' => 'admin.ministries.data'));
Route::get('ny/ministries/show/{id}', array('uses' => 'MinistriesController@getView', 'as' => 'admin.ministries.view'));
Route::post('ny/ministries/store/', array('uses' => 'MinistriesController@postNew', 'as' => 'admin.ministries.new'));
Route::post('ny/ministries/bulk/', array('uses' => 'MinistriesController@postBulkUpload', 'as' => 'admin.ministries.post'));
});
身份验证工作正常,但是当我尝试 Sentinel::check();当前登录用户返回的值为空
将此添加到 Http 文件夹
中的受保护中间件数组Kernel.php\Illuminate\Session\Middleware\StartSession::class
然后在下面注释掉,因为你没有使用 laravels 默认的授权功能
\Illuminate\Session\Middleware\AuthenticateSession::class