| Total Complexity | 2 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class GlobalToken extends Model implements ModelToken |
||
| 13 | { |
||
| 14 | use HasFactory; |
||
| 15 | |||
| 16 | protected $table = 'global_tokens'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string[] |
||
| 20 | */ |
||
| 21 | protected $fillable = [ |
||
| 22 | 'token', |
||
| 23 | 'title', |
||
| 24 | 'expiration', |
||
| 25 | 'last_use', |
||
| 26 | ]; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var string[] |
||
| 30 | */ |
||
| 31 | protected $dates = [ |
||
| 32 | 'expiration', |
||
| 33 | 'last_use', |
||
| 34 | 'created_at', |
||
| 35 | 'updated_at', |
||
| 36 | ]; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * The attributes that should be hidden for arrays. |
||
| 40 | * |
||
| 41 | * @var array |
||
| 42 | */ |
||
| 43 | protected $hidden = []; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * The attributes that should be casted to native types. |
||
| 47 | * |
||
| 48 | * @var array |
||
| 49 | */ |
||
| 50 | protected $casts = [ |
||
| 51 | 'id' => 'integer', |
||
| 52 | 'token' => 'string', |
||
| 53 | 'title' => 'string', |
||
| 54 | 'expiration' => 'datetime', |
||
| 55 | 'last_use' => 'datetime', |
||
| 56 | ]; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Validation rules |
||
| 60 | * |
||
| 61 | * @var array |
||
| 62 | */ |
||
| 63 | public static array $rules = [ |
||
| 64 | 'token' => 'required', |
||
| 65 | ]; |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Проверка валидности токена по дате |
||
| 69 | * @return bool |
||
| 70 | */ |
||
| 71 | public function isValid(): bool |
||
| 76 |