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

Test Setup Failed
Pull Request — development (#68)
by José
06:06
created

User   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 156
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 0
Metric Value
wmc 10
lcom 2
cbo 4
dl 0
loc 156
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getFullNameAttribute() 0 4 1
A getAvatarAttribute() 0 4 2
A campaigns() 0 4 1
A bloodType() 0 4 1
A invites() 0 4 1
A comments() 0 4 1
A getIsActiveAttribute() 0 4 1
A getRouteKeyName() 0 4 1
A getPhoneNumberAttribute() 0 4 1
1
<?php
2
3
namespace GiveBlood\Modules\Users;
4
5
use Illuminate\Notifications\Notifiable;
6
use Illuminate\Foundation\Auth\User as Authenticatable;
7
use Illuminate\Database\Eloquent\SoftDeletes;
8
9
use GiveBlood\Modules\Campaign\Campaign;
10
use GiveBlood\Modules\Users\Invite;
11
use GiveBlood\Modules\Blood\BloodType;
12
use GiveBlood\Traits\UuidTrait;
13
14
class User extends Authenticatable
15
{
16
    use Notifiable, SoftDeletes, UuidTrait;
17
18
    /**
19
     * The attributes that are mass assignable.
20
     *
21
     * @var array
22
     */
23
    protected $fillable =
24
      [
25
        'first_name',
26
        'last_name',
27
        'email',
28
        'username',
29
        'phone',
30
        'country_code',
31
        'bio',
32
        'birthdate',
33
        'active',
34
        'password',
35
        'blood_type_id',
36
        ];
37
38
    /**
39
     * The attributes that should be hidden for arrays.
40
     *
41
     * @var array
42
     */
43
    protected $hidden =
44
        [
45
          'password',
46
          'uid',
47
          'remember_token',
48
          'created_at',
49
          'updated_at',
50
          'deleted_at',
51
          'phone',
52
          'active',
53
          'username',
54
          'is_active',
55
          'birthdate',
56
          'email',
57
          'blood_type_id'
58
        ];
59
60
      /**
61
       * Indicates if the IDs are auto-incrementing.
62
       *
63
       * @var bool
64
       */
65
    public $incrementing = false;
66
67
    /**
68
     * The dates attributes.
69
     *
70
     * @var array $dates
71
     */
72
    protected $dates =
73
      [
74
        'created_at',
75
        'updated_at',
76
        'deleted_at'
77
      ];
78
79
    protected $appends =
80
      [
81
        'is_active'
82
      ];
83
84
    /**
85
     * Returns the full name of user.
86
     *
87
     * @return string
88
     */
89
    public function getFullNameAttribute($value)
90
    {
91
        return ucfirst($this->first_name).' '.ucfirst($this->last_name);
92
    }
93
94
    /**
95
     * Get user avatar or set default.png as default.
96
     *
97
     * @return string
98
     */
99
    public function getAvatarAttribute($avatar)
100
    {
101
        return asset($avatar ?: 'images/avatars/default.png');
102
    }
103
104
    /**
105
     * Returns the campaigns created by the user.
106
     *
107
     * @return \Illuminate\Database\Eloquent\Relations\HasMany relationship
108
     * @var    array
109
     */
110
    public function campaigns()
111
    {
112
        return $this->hasMany(Campaign::class);
113
    }
114
115
    /**
116
     * Related.
117
     *
118
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
119
     */
120
    public function bloodType()
121
    {
122
        return $this->belongsTo(BloodType::class, 'blood_type_id');
123
    }
124
125
    /**
126
     * Return as Many invites created by user.
127
     */
128
    public function invites()
129
    {
130
        return $this->hasMany(Invite::class);
131
    }
132
133
    /**
134
     * Returns the comments created by the user.
135
     *
136
     * @return \Illuminate\Database\Eloquent\Relations\HasMany relationship
137
     * @var    array
138
     */
139
    public function comments()
140
    {
141
        return $this->hasMany(Comment::class);
142
    }
143
144
    public function getIsActiveAttribute()
145
    {
146
        return $this->attributes[ 'status' ] == "active";
147
    }
148
149
    /**
150
     * Get the route key for the model.
151
     *
152
     * @return string
153
     */
154
    public function getRouteKeyName()
155
    {
156
        return 'username';
157
    }
158
159
    /**
160
     * Get the user phone number
161
     *
162
     * @return string
163
     */
164
    public function getPhoneNumberAttribute()
165
    {
166
        return $this->attributes[ 'phone' ];
167
    }
168
169
}
170