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 (2fd2c3)
by José
03:42
created

User::donor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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\Invite;
10
use DoeSangue\Models\BloodType;
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
      [
24
        'first_name',
25
        'last_name',
26
        'email',
27
        'username',
28
        'phone',
29
        'bio',
30
        'birthdate',
31
        'active',
32
        'password',
33
        'blood_type_id',
34
       ];
35
36
    /**
37
     * The attributes that should be hidden for arrays.
38
     *
39
     * @var array
40
     */
41
    protected $hidden =
42
        [
43
          'password',
44
          'remember_token',
45
          'created_at',
46
          'updated_at',
47
          'deleted_at',
48
          'id',
49
          'phone',
50
          'active',
51
          'username',
52
          'is_active',
53
          'birthdate',
54
          'email',
55
          'blood_type_id'
56
        ];
57
58
    /**
59
     * The dates attributes.
60
     *
61
     * @var array $dates
62
     */
63
    protected $dates =
64
      [
65
        'created_at',
66
        'updated_at',
67
        'deleted_at'
68
      ];
69
70
    protected $appends =
71
      [
72
        'is_active'
73
      ];
74
75
    /**
76
     * Returns the full name of user.
77
     *
78
     * @return string
79
     */
80
    public function getFullNameAttribute($value)
81
    {
82
        return ucfirst($this->first_name).' '.ucfirst($this->last_name);
83
    }
84
85
    /**
86
     * Returns the campaigns created by the user.
87
     *
88
     * @return array relationship
89
     * @var    array
90
     */
91
    public function campaigns()
92
    {
93
        return $this->hasMany(Campaign::class);
94
    }
95
96
    /**
97
     * Related.
98
     *
99
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
100
     */
101
    public function bloodType()
102
    {
103
        return $this->belongsTo(BloodType::class, 'blood_type_id');
104
    }
105
106
    /**
107
     * Return as Many invites created by user.
108
     */
109
    public function invites()
110
    {
111
        return $this->hasMany(Invite::class);
112
    }
113
114
    /**
115
     * Returns the comments created by the user.
116
     *
117
     * @return array relationship
118
     * @var    array
119
     */
120
    public function comments()
121
    {
122
        return $this->hasMany(Comment::class);
123
    }
124
125
    public function getIsActiveAttribute()
126
    {
127
        return $this->attributes[ 'status' ] == "active";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal active does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
128
    }
129
130
    /**
131
     * Get the route key for the model.
132
     *
133
     * @return string
134
     */
135
    public function getRouteKeyName()
136
    {
137
        return 'username';
138
    }
139
}
140