Here, I have extended User
Identity of Yii2.
This is my configuration.
'user' => [
'identityClass' => appmodelsUserMaster::class,
'enableAutoLogin' => false,
'loginUrl' => ['/auth/login'],
'authTimeout' => 86400
],
Here, I have defined authTimout
statically. But, What I want to do is that I want to fetch timeout value from database and set it in authTimeout
.
Thanks.
You can use event to set
authTimeout
before request will be handled:But probably more clear approach would be to create custom component and handle this in
init()
.Then use new component in your config: