我对 Laravel 框架很陌生。我正在开发一个应用程序,当用户处于非活动状态 5 分钟时,它会自动注销。我使用了这里的代码:https : //github.com/unicodeveloper/laravel-sessiontimeout/blob/master/src/Middleware/SessionTimeout.php但它似乎对我不起作用。
这是中间件代码:
<?php
namespace App\Http\Middleware;
use Closure;
use Auth;
use Illuminate\Session\Store;
class SessionTimeOutMiddleware
{
/**
* Instance of Session Store
* @var session
*/
protected $session;
/**
* Time for user to remain active, set to 300 secs( 5 minutes )
* @var timeout
*/
protected $timeout = 300;
public function __construct(Store $session){
$this->session = $session;
$this->redirectUrl = 'auth/login';
$this->sessionLabel = 'warning';
}
/**
* Handle an incoming request.
*
* @param …Run Code Online (Sandbox Code Playgroud)