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
|
|
|
|