Logic Architecuture for passport token expire time
I don't know that much about passport.I need advice for passport token expire time.I searched for it but I still haven't found any appropiate answer. When user click remember_me token lifetime should be long-lived. So,
//AuthServiceProvider.php
if ($request->remember_me) {
Passport::personalAccessTokensExpireIn(Carbon::now()->addHours(1));
} else {
Passport::personalAccessTokensExpireIn(Carbon::now()->addMinutes(1));
}
It works but I think that isn't not appropiate solution.I didn't want to set this logic in AuthServiceProvider.php.I want to handle in controller.
//Controller
if ($request->remember_me) {
Passport::personalAccessTokensExpireIn(Carbon::now()->addHours(1));//it doesn't work
$token->expires_at = Carbon::now()->addHours(1);//only work in database value ,it doesn't affect for passport
}
//AuthServiceProvider
Passport::personalAccessTokensExpireIn(Carbon::now()->addMinutes(1)); //I want to put this default.