Changeset View
Changeset View
Standalone View
Standalone View
src/app/VerificationCode.php
Show All 20 Lines | class VerificationCode extends Model | ||||
// Code expires after so many hours | // Code expires after so many hours | ||||
public const SHORTCODE_LENGTH = 8; | public const SHORTCODE_LENGTH = 8; | ||||
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 = 8; | public const CODE_EXP_HOURS = 8; | ||||
/** | /** @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 bool Indicates if the model should be timestamped */ | ||||
* Indicates if the model should be timestamped. | |||||
* | |||||
* @var bool | |||||
*/ | |||||
public $timestamps = false; | public $timestamps = false; | ||||
/** | /** @var array<string, string> Casts properties as type */ | ||||
* Casts properties as type | |||||
* | |||||
* @var array | |||||
*/ | |||||
protected $casts = [ | protected $casts = [ | ||||
'active' => 'boolean', | 'active' => 'boolean', | ||||
'expires_at' => 'datetime', | 'expires_at' => 'datetime', | ||||
]; | ]; | ||||
/** | /** @var array<int, string> The attributes that are mass assignable */ | ||||
* The attributes that are mass assignable. | |||||
* | |||||
* @var array | |||||
*/ | |||||
protected $fillable = ['user_id', 'code', 'short_code', 'mode', 'expires_at', 'active']; | protected $fillable = ['user_id', 'code', 'short_code', 'mode', 'expires_at', 'active']; | ||||
/** | /** | ||||
* Generate a short code (for human). | * Generate a short code (for human). | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
Show All 17 Lines | class VerificationCode extends Model | ||||
/** | /** | ||||
* The user to which this code belongs. | * The user to which this code belongs. | ||||
* | * | ||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||||
*/ | */ | ||||
public function user() | public function user() | ||||
{ | { | ||||
return $this->belongsTo('\App\User', 'user_id', 'id'); | return $this->belongsTo(User::class, 'user_id', 'id'); | ||||
} | } | ||||
} | } |