Changeset View
Changeset View
Standalone View
Standalone View
src/app/SignupCode.php
Show All 29 Lines | class SignupCode extends Model | ||||
public const SHORTCODE_LENGTH = 5; | public const SHORTCODE_LENGTH = 5; | ||||
public const CODE_LENGTH = 32; | public const CODE_LENGTH = 32; | ||||
// Code expires after so many hours | // Code expires after so many hours | ||||
public const CODE_EXP_HOURS = 24; | public const CODE_EXP_HOURS = 24; | ||||
/** | /** @var string The primary key associated with the table */ | ||||
* The primary key associated with the table. | |||||
* | |||||
* @var string | |||||
*/ | |||||
protected $primaryKey = 'code'; | protected $primaryKey = 'code'; | ||||
/** | /** @var bool Indicates if the IDs are auto-incrementing */ | ||||
* Indicates if the IDs are auto-incrementing. | |||||
* | |||||
* @var bool | |||||
*/ | |||||
public $incrementing = false; | public $incrementing = false; | ||||
/** | /** @var string The "type" of the auto-incrementing ID */ | ||||
* The "type" of the auto-incrementing ID. | |||||
* | |||||
* @var string | |||||
*/ | |||||
protected $keyType = 'string'; | protected $keyType = 'string'; | ||||
/** | /** @var array<int, string> The attributes that are mass assignable */ | ||||
* The attributes that are mass assignable. | |||||
* | |||||
* @var array | |||||
*/ | |||||
protected $fillable = [ | protected $fillable = [ | ||||
'code', | 'code', | ||||
'email', | 'email', | ||||
'expires_at', | 'expires_at', | ||||
'first_name', | 'first_name', | ||||
'last_name', | 'last_name', | ||||
'plan', | 'plan', | ||||
'short_code', | 'short_code', | ||||
'voucher' | 'voucher' | ||||
]; | ]; | ||||
protected $casts = ['headers' => 'array']; | /** @var array<string, string> The attributes that should be cast */ | ||||
protected $casts = [ | |||||
'expires_at' => 'datetime:Y-m-d H:i:s', | |||||
'headers' => 'array' | |||||
]; | |||||
/** | |||||
* The attributes that should be mutated to dates. | |||||
* | |||||
* @var array | |||||
*/ | |||||
protected $dates = ['expires_at']; | |||||
/** | /** | ||||
* Check if code is expired. | * Check if code is expired. | ||||
* | * | ||||
* @return bool True if code is expired, False otherwise | * @return bool True if code is expired, False otherwise | ||||
*/ | */ | ||||
public function isExpired() | public function isExpired() | ||||
{ | { | ||||
Show All 16 Lines |