Passed
Push — master ( 6b9ecc...8f9c24 )
by Paul
03:57
created

User::sendEmailVerificationNotification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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;
0 ignored issues
show
Bug introduced by
The trait Illuminate\Notifications\Notifiable requires the property $email which is not provided by Devpri\Tinre\Models\User.
Loading history...
Bug introduced by
The trait Devpri\Tinre\Traits\HasApiTokens requires the property $role which is not provided by Devpri\Tinre\Models\User.
Loading history...
introduced by
The trait Devpri\Tinre\Traits\HasPermissions requires some properties which are not provided by Devpri\Tinre\Models\User: $role, $permissions
Loading history...
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