|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Devpri\Tinre\Models; |
|
4
|
|
|
|
|
5
|
|
|
use Devpri\Tinre\Notifications\EmailVerificationNotification; |
|
6
|
|
|
use Devpri\Tinre\Notifications\ResetPasswordNotification; |
|
7
|
|
|
use Devpri\Tinre\Traits\AuthorizedActions; |
|
8
|
|
|
use Devpri\Tinre\Traits\HasApiTokens; |
|
9
|
|
|
use Devpri\Tinre\Traits\HasPermissions; |
|
10
|
|
|
use Illuminate\Contracts\Auth\MustVerifyEmail; |
|
11
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable; |
|
12
|
|
|
use Illuminate\Notifications\Notifiable; |
|
13
|
|
|
|
|
14
|
|
|
class User extends Authenticatable implements MustVerifyEmail |
|
15
|
|
|
{ |
|
16
|
|
|
use Notifiable, AuthorizedActions, HasPermissions, HasApiTokens; |
|
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
protected $actions = ['viewAny', 'view', 'create', 'update', 'updateOwn', 'changeEmail', 'delete']; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* The attributes that are mass assignable. |
|
22
|
|
|
* |
|
23
|
|
|
* @var array |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $fillable = [ |
|
26
|
|
|
'active', 'name', 'email', 'role', 'password', |
|
27
|
|
|
]; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* The attributes that should be hidden for arrays. |
|
31
|
|
|
* |
|
32
|
|
|
* @var array |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $hidden = [ |
|
35
|
|
|
'password', 'remember_token', |
|
36
|
|
|
]; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* The attributes that should be cast to native types. |
|
40
|
|
|
* |
|
41
|
|
|
* @var array |
|
42
|
|
|
*/ |
|
43
|
|
|
protected $casts = [ |
|
44
|
|
|
'email_verified_at' => 'datetime', |
|
45
|
|
|
]; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Send the password reset notification. |
|
49
|
|
|
* |
|
50
|
|
|
* @param string $token |
|
51
|
|
|
* @return void |
|
52
|
|
|
*/ |
|
53
|
1 |
|
public function sendPasswordResetNotification($token) |
|
54
|
|
|
{ |
|
55
|
1 |
|
$this->notify(new ResetPasswordNotification($token)); |
|
56
|
1 |
|
} |
|
57
|
|
|
|
|
58
|
1 |
|
public function sendEmailVerificationNotification() |
|
59
|
|
|
{ |
|
60
|
1 |
|
$this->notify(new EmailVerificationNotification()); |
|
61
|
1 |
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function urls() |
|
64
|
|
|
{ |
|
65
|
|
|
return $this->hasMany('Devpri\Tinre\Models\Url'); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|