Passed
Push — dev5 ( 8662bf...df64bd )
by Ron
12:04
created

User::UserSettings()   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;
4
5
use Illuminate\Notifications\Notifiable;
6
use Illuminate\Foundation\Auth\User as Authenticatable;
7
8
class User extends Authenticatable
9
{
10
    use Notifiable;
11
12
    /**
13
     * The attributes that are mass assignable.
14
     *
15
     * @var array
16
     */
17
    protected $fillable = ['role_id', 'username', 'first_name', 'last_name', 'email', 'password', 'password_expires', 'active'];
18
    protected $hidden = ['password', 'remember_token', 'is_installer', 'active', 'created_at', 'password_expires', 'updated_at', 'user_id', 'username'];
19
    //  Database primary key
20
    protected $primaryKey = 'user_id';
21
22
    protected $appends = [ 'full_name' ];
23
24 220
    public function getFullNameAttribute()
25
    {
26 220
        return "{$this->first_name} {$this->last_name}";
27
    }
28
29 2
    public function UserLogins()
30
    {
31 2
        return $this->hasMany('App\UserLogins', 'user_id', 'user_id');
32
    }
33
34 2
    public function FileLinks()
35
    {
36 2
        return $this->hasMany('App\FileLinks', 'user_id', 'user_id');
37
    }
38
39
    // public function UserPermissions()
40
    // {
41
    //     return $this->hasOne('App\UserPermissions', '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
    // public function UserRolePermissions()
50
    // {
51
    //     return $this->hasManyThrough('App\UserRolePermissions', 'App\UserRoles', 'user_id', 'role_id', 'user_id', 'role_id');
52
    // }
53
}
54