Total Complexity | 4 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class RefreshToken extends Model implements ModelToken |
||
15 | { |
||
16 | use HasFactory; |
||
17 | |||
18 | protected $table = 'refresh_tokens'; |
||
19 | |||
20 | /** |
||
21 | * @var string[] |
||
22 | */ |
||
23 | protected $fillable = [ |
||
24 | 'token', |
||
25 | 'user_id', |
||
26 | 'user_type', |
||
27 | 'access_token_id', |
||
28 | 'expiration', |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * @var string[] |
||
33 | */ |
||
34 | protected $dates = [ |
||
35 | 'expiration', |
||
36 | 'created_at', |
||
37 | 'updated_at', |
||
38 | ]; |
||
39 | |||
40 | /** |
||
41 | * The attributes that should be casted to native types. |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $casts = [ |
||
46 | 'id' => 'integer', |
||
47 | 'token' => 'string', |
||
48 | 'user_id' => 'integer', |
||
49 | 'user_type' => 'string', |
||
50 | 'access_token_id' => 'integer', |
||
51 | 'expiration' => 'datetime', |
||
52 | ]; |
||
53 | |||
54 | /** |
||
55 | * Validation rules |
||
56 | * |
||
57 | * @var array |
||
58 | */ |
||
59 | public static array $rules = [ |
||
60 | 'token' => 'required', |
||
61 | ]; |
||
62 | |||
63 | /** |
||
64 | * @return MorphTo |
||
65 | */ |
||
66 | public function user(): MorphTo |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return BelongsTo |
||
73 | */ |
||
74 | public function accessToken(): BelongsTo |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * Проверка валидности токена по дате |
||
81 | * @return bool |
||
82 | */ |
||
83 | public function isValid(): bool |
||
88 |