pemegang fungsi awam($permintaan, Penutupan $seterusnya, $penjaga = 'pengurus')
{
if (!Auth::guard($guard)->check()) {
return redirect('manager/login');
}
if (config('misc.session_timeout_status')) {
$isLoggedIn = $request->path() != '/manager/logout';
if (!session('lastActivityTime')) {
$this->session->put('lastActivityTime', time());
} elseif (time() - $this->session->get('lastActivityTime') > $this->timeout) {
debugbar()->info('时间到!'.$this->timeout);
log::info('时间到!'.$this->timeout);
$this->session->forget('lastActivityTime');
$cookie = cookie('intend', $isLoggedIn ? url()->current() : 'manager/');
$email = Auth::guard($guard)->user()->email;
session()->flash('flash_danger', '您自动登出是出于安全原因,因为您' . $this->timeout / 60 . '分钟内没有活动。');
Auth::guard($guard)->logout();
return redirect()->to('/manager/login')->withErrors('您自动登出是出于安全原因,因为您' . $this->timeout / 60 . '分钟内没有活动。')->withInput(compact('email'))->withCookie($cookie);
}
$isLoggedIn ? $this->session->put('lastActivityTime', time()) : $this->session->forget('lastActivityTime');
}
return $next($request);
}
redirect后session或error都没值了,login接收不到数据,路由如下:
Laluan::kumpulan(['ruang nama' => 'Pengurus', 'awalan' => 'pengurus'], fungsi () {
Route::auth();
Route::group([
'middleware' => ['admin'],
], function () {
Route::get('/', 'HomeController@index');
Route::resource('article', 'ArticleController');
});
});
不知道哪里出问题了。
Komponen tengah 'middleware' => ['admin'], disebabkan