1 | <?php |
||
10 | class RefreshToken extends Model |
||
11 | { |
||
12 | use ValidatingTrait; |
||
13 | |||
14 | /** |
||
15 | * {@inheritdoc} |
||
16 | */ |
||
17 | protected $fillable = [ |
||
18 | 'identifier', |
||
19 | 'access_token_identifier', |
||
20 | 'is_revoked', |
||
21 | 'expires_at', |
||
22 | ]; |
||
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | protected $casts = [ |
||
28 | 'identifier' => 'string', |
||
29 | 'access_token_identifier' => 'string', |
||
30 | 'is_revoked' => 'boolean', |
||
31 | 'expires_at' => 'date', |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | protected $observables = [ |
||
38 | 'validating', |
||
39 | 'validated', |
||
40 | ]; |
||
41 | |||
42 | /** |
||
43 | * The default rules that the model will validate against. |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | protected $rules = []; |
||
48 | |||
49 | /** |
||
50 | * Whether the model should throw a |
||
51 | * ValidationException if it fails validation. |
||
52 | * |
||
53 | * @var bool |
||
54 | */ |
||
55 | protected $throwValidationExceptions = true; |
||
56 | |||
57 | /** |
||
58 | * Create a new Eloquent model instance. |
||
59 | * |
||
60 | * @param array $attributes |
||
61 | */ |
||
62 | public function __construct(array $attributes = []) |
||
74 | |||
75 | /** |
||
76 | * Get the access token that the refresh token belongs to. |
||
77 | * |
||
78 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
79 | */ |
||
80 | public function accessToken() |
||
84 | |||
85 | /** |
||
86 | * Revoke the token instance. |
||
87 | * |
||
88 | * @return bool |
||
89 | */ |
||
90 | public function revoke() |
||
94 | |||
95 | /** |
||
96 | * Determine if the token is a transient JWT token. |
||
97 | * |
||
98 | * @return bool |
||
99 | */ |
||
100 | public function transient() |
||
104 | |||
105 | /** |
||
106 | * Determine if the token is revoked. |
||
107 | * |
||
108 | * @return bool |
||
109 | */ |
||
110 | public function isRevoked() |
||
114 | } |
||
115 |