File tree 2 files changed +27
-1
lines changed 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,13 @@ class Passport
68
68
*/
69
69
public static $ refreshTokensExpireAt ;
70
70
71
+ /**
72
+ * The date when personal access tokens expire.
73
+ *
74
+ * @var \DateTimeInterface|null
75
+ */
76
+ public static $ personAccessTokensExpireAt ;
77
+
71
78
/**
72
79
* The name for API token cookies.
73
80
*
@@ -315,6 +322,25 @@ public static function refreshTokensExpireIn(DateTimeInterface $date = null)
315
322
return new static ;
316
323
}
317
324
325
+ /**
326
+ * Get or set when personal access tokens expire.
327
+ *
328
+ * @param \DateTimeInterface|null $date
329
+ * @return \DateInterval|static
330
+ */
331
+ public static function personalAccessTokensExpireIn (DateTimeInterface $ date = null )
332
+ {
333
+ if (is_null ($ date )) {
334
+ return static ::$ personAccessTokensExpireAt
335
+ ? Carbon::now ()->diff (static ::$ personAccessTokensExpireAt )
336
+ : new DateInterval ('P1Y ' );
337
+ }
338
+
339
+ static ::$ personAccessTokensExpireAt = $ date ;
340
+
341
+ return new static ;
342
+ }
343
+
318
344
/**
319
345
* Get or set the name for API token cookies.
320
346
*
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ protected function registerAuthorizationServer()
111
111
);
112
112
113
113
$ server ->enableGrantType (
114
- new PersonalAccessGrant , new DateInterval ( ' P1Y ' )
114
+ new PersonalAccessGrant , Passport:: personalAccessTokensExpireIn ( )
115
115
);
116
116
117
117
$ server ->enableGrantType (
You can’t perform that action at this time.
0 commit comments