File tree 2 files changed +87
-0
lines changed
2 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 6
6
use DesignMyNight \Mongodb \Passport \AuthCode ;
7
7
use DesignMyNight \Mongodb \Passport \Client ;
8
8
use DesignMyNight \Mongodb \Passport \PersonalAccessClient ;
9
+ use DesignMyNight \Mongodb \Passport \RefreshToken ;
9
10
use DesignMyNight \Mongodb \Passport \Token ;
10
11
11
12
class MongodbPassportServiceProvider extends ServiceProvider
@@ -21,11 +22,13 @@ public function register()
21
22
$ loader ->alias ('Laravel\Passport\Client ' , Client::class);
22
23
$ loader ->alias ('Laravel\Passport\PersonalAccessClient ' , PersonalAccessClient::class);
23
24
$ loader ->alias ('Laravel\Passport\Token ' , Token::class);
25
+ $ loader ->alias ('Laravel\Passport\RefreshToken ' , RefreshToken::class);
24
26
} else {
25
27
class_alias ('Laravel\Passport\AuthCode ' , AuthCode::class);
26
28
class_alias ('Laravel\Passport\Client ' , Client::class);
27
29
class_alias ('Laravel\Passport\PersonalAccessClient ' , PersonalAccessClient::class);
28
30
class_alias ('Laravel\Passport\Token ' , Token::class);
31
+ class_alias ('Laravel\Passport\RefreshToken ' , RefreshToken::class);
29
32
}
30
33
}
31
34
}
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