-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccountProperties.php
More file actions
90 lines (78 loc) · 1.73 KB
/
Copy pathAccountProperties.php
File metadata and controls
90 lines (78 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
namespace Apolune\Account;
use Carbon\Carbon;
use Apolune\Core\Database\Eloquent\Model;
use Apolune\Core\Traits\AuthenticatableProperties;
use Apolune\Contracts\Account\AccountProperties as Contract;
class AccountProperties extends Model implements Contract
{
use AuthenticatableProperties;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = '__pandaac_accounts';
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['remember_token'];
/**
* Retrieve the pending email address.
*
* @return string
*/
public function email()
{
return $this->email;
}
/**
* Retrieve the email verification code.
*
* @return string
*/
public function emailCode()
{
return $this->email_code;
}
/**
* Retrieve the pending email address date.
*
* @return \Carbon\Carbon
*/
public function emailDate()
{
$days = config('pandaac.apolune.account.emailchange-days');
return (new Carbon($this->email_date))->addDays($days);
}
/**
* Retrieve the amount of email confirmation requests.
*
* @return integer
*/
public function emailRequests()
{
return (int) $this->email_requests;
}
/**
* Set a new email verification code.
*
* @return void
*/
public function setEmailCode()
{
$this->email_code = str_random(40);
$this->save();
}
/**
* Retrieve the deleted value.
*
* @return \Carbon\Carbon|null
*/
public function deletion()
{
return new Carbon($this->deleted);
}
}