Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Branch laravel-55 (e4caf7)
by José
06:15
created

User::invites()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace DoeSangue\Models;
4
5
use Illuminate\Notifications\Notifiable;
6
use Illuminate\Foundation\Auth\User as Authenticatable;
7
use Illuminate\Database\Eloquent\SoftDeletes;
8
use DoeSangue\Models\Campaign;
9
use DoeSangue\Models\Donor;
10
use DoeSangue\Models\Invite;
11
use DoeSangue\Models\Comment;
12
13
class User extends Authenticatable
14
{
15
    use Notifiable, SoftDeletes;
16
17
    /**
18
     * The attributes that are mass assignable.
19
     *
20
     * @var array
21
     */
22
    protected $fillable = [
23
                            'first_name',
24
                            'last_name',
25
                            'email',
26
                            'username',
27
                            'phone',
28
                            'bio',
29
                            'birthdate',
30
                            'active',
31
                            'password',
32
                          ];
33
34
    /**
35
     * The attributes that should be hidden for arrays.
36
     *
37
     * @var array
38
     */
39
    protected $hidden = [
40
                          'password',
41
                          'remember_token',
42
                          'created_at',
43
                          'updated_at',
44
                          'deleted_at',
45
                          'id',
46
                          'phone',
47
                          'active',
48
                          'username',
49
                          'is_active',
50
                          'birthdate',
51
                          'email'
52
                        ];
53
54
    /**
55
     * The dates attributes.
56
     *
57
     * @var array $dates
58
     */
59
    protected $dates = [
60
      'created_at', 'updated_at', 'deleted_at'
61
    ];
62
63
    protected $appends = [ 'is_active' ];
64
65
    /**
66
     * Returns the full name of user.
67
     *
68
     * @return string
69
     */
70
    public function getFullNameAttribute($value)
71
    {
72
        return ucfirst($this->first_name) . ' ' . ucfirst($this->last_name);
73
    }
74
75
    /**
76
     * Returns the campaigns created by the user.
77
     *
78
     * @return array relationship
79
     * @var    array
80
     */
81
    public function campaigns()
82
    {
83
        return $this->hasMany(Campaign::class);
84
    }
85
86
    public function donor()
87
    {
88
        return $this->hasOne(Donor::class);
89
    }
90
91
    /**
92
     * Return as Many invites created by user.
93
     */
94
    public function invites()
95
    {
96
        return $this->hasMany(Invite::class);
97
    }
98
99
    /**
100
     * Returns the comments created by the user.
101
     *
102
     * @return array relationship
103
     * @var    array
104
     */
105
    public function comments()
106
    {
107
        return $this->hasMany(Comment::class);
108
    }
109
110
    public function getIsActiveAttribute()
111
    {
112
        return $this->attributes['active'] == true;
113
    }
114
115
    /**
116
 * Get the route key for the model.
117
 *
118
 * @return string
119
 */
120
public function getRouteKeyName()
121
{
122
    return 'username';
123
}
124
}
125