Test Setup Failed
Push — master ( fd6859...9ae6dd )
by Adam
13:36
created

User::isAdmin()   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
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Models;
4
5
use App\Notifications\ResetPasswordNotification;
6
use Illuminate\Foundation\Auth\User as Authenticatable;
7
use Illuminate\Notifications\Notifiable;
8
9
/**
10
 * App\Models\User.
11
 *
12
 * @property int $id
13
 * @property string $name
14
 * @property string $email
15
 * @property string $password
16
 * @property string|null $remember_token
17
 * @property bool $is_admin
18
 * @property \Illuminate\Support\Carbon $created_at
19
 * @property \Illuminate\Support\Carbon $updated_at
20
 * @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
21
 *
22
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereCreatedAt($value)
23
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereEmail($value)
24
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereId($value)
25
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereIsAdmin($value)
26
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereName($value)
27
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User wherePassword($value)
28
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereRememberToken($value)
29
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\User whereUpdatedAt($value)
30
 * @mixin \Eloquent
31
 */
32
class User extends Authenticatable
33
{
34
    use Notifiable;
0 ignored issues
show
Bug introduced by
The trait Illuminate\Notifications\Notifiable requires the property $phone_number which is not provided by App\Models\User.
Loading history...
35
36
    /**
37
     * The attributes that are mass assignable.
38
     *
39
     * @var array
40
     */
41
    protected $fillable = [
42
        'name', 'email', 'password', 'is_admin',
43
    ];
44
45
    /**
46
     * The attributes that should be cast to native types.
47
     *
48
     * @var array
49
     */
50
    protected $casts = [
51
        'is_admin' => 'boolean',
52
    ];
53
54
    /**
55
     * The attributes that should be hidden for arrays.
56
     *
57
     * @var array
58
     */
59
    protected $hidden = [
60
        'password', 'remember_token',
61
    ];
62
63
    /**
64
     * Send the password reset notification.
65
     *
66
     * @param string $token
67
     *
68
     * @return void
69
     */
70 1
    public function sendPasswordResetNotification($token)
71
    {
72 1
        $this->notify(new ResetPasswordNotification($token));
73 1
    }
74
75 83
    public function isAdmin()
76
    {
77 83
        return $this->is_admin;
78
    }
79
}
80