Changeset View
Changeset View
Standalone View
Standalone View
src/app/SignupCode.php
<?php | <?php | ||||
namespace App; | namespace App; | ||||
use App\Traits\BelongsToUserTrait; | |||||
use Carbon\Carbon; | use Carbon\Carbon; | ||||
use Illuminate\Database\Eloquent\Model; | use Illuminate\Database\Eloquent\Model; | ||||
use Illuminate\Database\Eloquent\SoftDeletes; | use Illuminate\Database\Eloquent\SoftDeletes; | ||||
/** | /** | ||||
* The eloquent definition of a SignupCode. | * The eloquent definition of a SignupCode. | ||||
* | * | ||||
* @property string $code The full code identifier | * @property string $code The full code identifier | ||||
* @property \Carbon\Carbon $created_at The creation timestamp | * @property \Carbon\Carbon $created_at The creation timestamp | ||||
* @property \Carbon\Carbon $deleted_at The deletion timestamp | * @property \Carbon\Carbon $deleted_at The deletion timestamp | ||||
* @property ?string $domain_part Email domain | * @property ?string $domain_part Email domain | ||||
* @property ?string $email Email address | * @property ?string $email Email address | ||||
* @property \Carbon\Carbon $expires_at The code expiration timestamp | * @property \Carbon\Carbon $expires_at The code expiration timestamp | ||||
* @property ?string $first_name Firstname | * @property ?string $first_name Firstname | ||||
* @property string $ip_address IP address the request came from | * @property string $ip_address IP address the request came from | ||||
* @property ?string $last_name Lastname | * @property ?string $last_name Lastname | ||||
* @property ?string $local_part Email local part | * @property ?string $local_part Email local part | ||||
* @property ?string $plan Plan title | * @property ?string $plan Plan title | ||||
* @property string $short_code Short validation code | * @property string $short_code Short validation code | ||||
* @property \Carbon\Carbon $updated_at The update timestamp | * @property \Carbon\Carbon $updated_at The update timestamp | ||||
* @property string $submit_ip_address IP address the final signup submit request came from | |||||
* @property string $verify_ip_address IP address the code verify request came from | |||||
* @property ?string $voucher Voucher discount code | * @property ?string $voucher Voucher discount code | ||||
*/ | */ | ||||
class SignupCode extends Model | class SignupCode extends Model | ||||
{ | { | ||||
use SoftDeletes; | use SoftDeletes; | ||||
use BelongsToUserTrait; | |||||
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; | ||||
Show All 15 Lines | protected $fillable = [ | ||||
'last_name', | 'last_name', | ||||
'plan', | 'plan', | ||||
'short_code', | 'short_code', | ||||
'voucher' | 'voucher' | ||||
]; | ]; | ||||
/** @var array<string, string> The attributes that should be cast */ | /** @var array<string, string> The attributes that should be cast */ | ||||
protected $casts = [ | protected $casts = [ | ||||
'created_at' => 'datetime:Y-m-d H:i:s', | |||||
'deleted_at' => 'datetime:Y-m-d H:i:s', | |||||
'updated_at' => 'datetime:Y-m-d H:i:s', | |||||
'expires_at' => 'datetime:Y-m-d H:i:s', | 'expires_at' => 'datetime:Y-m-d H:i:s', | ||||
'headers' => 'array' | 'headers' => 'array' | ||||
]; | ]; | ||||
/** | /** | ||||
* Check if code is expired. | * Check if code is expired. | ||||
* | * | ||||
Show All 20 Lines |