|
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 = [ |
|
18
|
|
|
'username', 'first_name', 'last_name', 'email', 'password', 'password_expires', 'active', 'is_installer' |
|
19
|
|
|
]; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* The attributes that should be hidden for arrays. |
|
23
|
|
|
* |
|
24
|
|
|
* @var array |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $hidden = [ |
|
27
|
|
|
'password', 'remember_token', 'is_installer', 'active', 'created_at', 'password_expires', 'updated_at', 'user_id', 'username' |
|
28
|
|
|
]; |
|
29
|
|
|
|
|
30
|
|
|
// Database primary key |
|
31
|
|
|
protected $primaryKey = 'user_id'; |
|
32
|
|
|
|
|
33
|
|
|
protected $appends = [ 'full_name' ]; |
|
34
|
|
|
|
|
35
|
|
|
public function getFullNameAttribute() |
|
36
|
|
|
{ |
|
37
|
|
|
return "{$this->first_name} {$this->last_name}"; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function UserLogins() |
|
41
|
|
|
{ |
|
42
|
|
|
return $this->hasMany('App\UserLogins', 'user_id', 'user_id'); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function systemFiles() |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->hasMany('App\SystemFiles', 'user_id', 'user_id'); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function customerFavs() |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->belongsTo('App\CustomerFavs', 'user_id', 'user_id'); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function customerNotes() |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->belongsTo('App\CustomerNotes', 'user_id', 'user_id'); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function techTips() |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->belongsTo('App\TechTips', 'user_id', 'user_id'); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function techTipComments() |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->belongsTo('App\TechTipComments', 'user_id', 'user_id'); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function fileLinks() |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->hasMany('App\FileLinks', 'user_id', 'user_id'); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|