Passed
Push — master ( 3b9459...1d6d9a )
by Ron
11:07 queued 34s
created

User   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 38
ccs 8
cts 10
cp 0.8
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getFullNameAttribute() 0 3 1
A UserLogins() 0 3 1
A UserSettings() 0 3 1
A LastUserLogin() 0 3 1
A FileLinks() 0 3 1
1
<?php
2
3
namespace App;
4
5
use Illuminate\Notifications\Notifiable;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
use Illuminate\Foundation\Auth\User as Authenticatable;
8
9
class User extends Authenticatable
10
{
11
    use Notifiable;
12
    use SoftDeletes;
13
14
    protected $primaryKey = 'user_id';
15
    protected $fillable   = ['role_id', 'username', 'first_name', 'last_name', 'email', 'password', 'password_expires', 'active'];
16
    protected $appends    = [ 'full_name' ];
17
    protected $hidden     = ['password', 'remember_token', 'is_installer', 'active', 'created_at', 'password_expires', 'updated_at', 'user_id', 'username'];
18
    protected $casts      = [
19
        'created_at' => 'datetime:M d, Y',
20
        'updated_at' => 'datetime:M d, Y',
21
        'deleted_at' => 'datetime:M d, Y'
22
    ];
23
24 522
    public function getFullNameAttribute()
25
    {
26 522
        return "{$this->first_name} {$this->last_name}";
27
    }
28
29
    public function UserLogins()
30
    {
31
        return $this->hasMany('App\UserLogins', 'user_id', 'user_id');
32
    }
33
34 2
    public function LastUserLogin()
35
    {
36 2
        return $this->hasOne('App\UserLogins', 'user_id', 'user_id')->latest();
37
    }
38
39 2
    public function FileLinks()
40
    {
41 2
        return $this->hasMany('App\FileLinks', 'user_id', 'user_id');
42
    }
43
44 4
    public function UserSettings()
45
    {
46 4
        return $this->hasOne('App\UserSettings', 'user_id', 'user_id');
47
    }
48
}
49