File tree Expand file tree Collapse file tree 2 files changed +87
-0
lines changed Expand file tree Collapse file tree 2 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 66use DesignMyNight \Mongodb \Passport \AuthCode ;
77use DesignMyNight \Mongodb \Passport \Client ;
88use DesignMyNight \Mongodb \Passport \PersonalAccessClient ;
9+ use DesignMyNight \Mongodb \Passport \RefreshToken ;
910use DesignMyNight \Mongodb \Passport \Token ;
1011
1112class MongodbPassportServiceProvider extends ServiceProvider
@@ -21,11 +22,13 @@ public function register()
2122 $ loader ->alias ('Laravel\Passport\Client ' , Client::class);
2223 $ loader ->alias ('Laravel\Passport\PersonalAccessClient ' , PersonalAccessClient::class);
2324 $ loader ->alias ('Laravel\Passport\Token ' , Token::class);
25+ $ loader ->alias ('Laravel\Passport\RefreshToken ' , RefreshToken::class);
2426 } else {
2527 class_alias ('Laravel\Passport\AuthCode ' , AuthCode::class);
2628 class_alias ('Laravel\Passport\Client ' , Client::class);
2729 class_alias ('Laravel\Passport\PersonalAccessClient ' , PersonalAccessClient::class);
2830 class_alias ('Laravel\Passport\Token ' , Token::class);
31+ class_alias ('Laravel\Passport\RefreshToken ' , RefreshToken::class);
2932 }
3033 }
3134}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace DesignMyNight \Mongodb \Passport ;
4+
5+ use Jenssegers \Mongodb \Eloquent \Model ;
6+
7+ class RefreshToken extends Model
8+ {
9+ /**
10+ * The database table used by the model.
11+ *
12+ * @var string
13+ */
14+ protected $ table = 'oauth_refresh_tokens ' ;
15+
16+ /**
17+ * Indicates if the IDs are auto-incrementing.
18+ *
19+ * @var bool
20+ */
21+ public $ incrementing = false ;
22+
23+ /**
24+ * The guarded attributes on the model.
25+ *
26+ * @var array
27+ */
28+ protected $ guarded = [];
29+
30+ /**
31+ * The attributes that should be cast to native types.
32+ *
33+ * @var array
34+ */
35+ protected $ casts = [
36+ 'revoked ' => 'bool ' ,
37+ ];
38+
39+ /**
40+ * The attributes that should be mutated to dates.
41+ *
42+ * @var array
43+ */
44+ protected $ dates = [
45+ 'expires_at ' ,
46+ ];
47+
48+ /**
49+ * Indicates if the model should be timestamped.
50+ *
51+ * @var bool
52+ */
53+ public $ timestamps = false ;
54+
55+ /**
56+ * Get the access token that the refresh token belongs to.
57+ *
58+ * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
59+ */
60+ public function accessToken ()
61+ {
62+ return $ this ->belongsTo (Passport::tokenModel ());
63+ }
64+
65+ /**
66+ * Revoke the token instance.
67+ *
68+ * @return bool
69+ */
70+ public function revoke ()
71+ {
72+ return $ this ->forceFill (['revoked ' => true ])->save ();
73+ }
74+
75+ /**
76+ * Determine if the token is a transient JWT token.
77+ *
78+ * @return bool
79+ */
80+ public function transient ()
81+ {
82+ return false ;
83+ }
84+ }
You can’t perform that action at this time.
0 commit comments