Total Complexity | 2 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
11 | class GlobalToken extends Model |
||
12 | { |
||
13 | use HasFactory; |
||
14 | |||
15 | protected $table = 'global_tokens'; |
||
16 | |||
17 | /** |
||
18 | * @var string[] |
||
19 | */ |
||
20 | protected $fillable = [ |
||
21 | 'token', |
||
22 | 'title', |
||
23 | 'expiration', |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * @var string[] |
||
28 | */ |
||
29 | protected $dates = [ |
||
30 | 'expiration', |
||
31 | 'created_at', |
||
32 | 'updated_at', |
||
33 | ]; |
||
34 | |||
35 | /** |
||
36 | * The attributes that should be hidden for arrays. |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $hidden = []; |
||
41 | |||
42 | /** |
||
43 | * The attributes that should be casted to native types. |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | protected $casts = [ |
||
48 | 'id' => 'integer', |
||
49 | 'token' => 'string', |
||
50 | 'title' => 'string', |
||
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 | * Проверка валидности токена по дате |
||
65 | * @return bool |
||
66 | */ |
||
67 | public function isValid(): bool |
||
72 |