1 | <?php |
||
9 | abstract class BaseUser extends Authenticatable |
||
10 | { |
||
11 | use Notifiable; |
||
12 | |||
13 | /** |
||
14 | * The attributes that are mass assignable. |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $fillable = [ |
||
19 | 'name', 'email', 'password', |
||
20 | ]; |
||
21 | |||
22 | /** |
||
23 | * The attributes that should be hidden for arrays. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $hidden = [ |
||
28 | 'password', 'remember_token', |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * Return all of the tenants this user is the owner of |
||
33 | */ |
||
34 | public function roles() |
||
43 | |||
44 | /** |
||
45 | * Assign the provided role to the user |
||
46 | * |
||
47 | * @param BaseRole $role |
||
48 | * |
||
49 | * @return BaseUser |
||
50 | */ |
||
51 | public function assignRole(BaseRole $role) |
||
57 | |||
58 | /** |
||
59 | * Check if a user has the provided role. |
||
60 | * Accepected values are string with the name of the role, |
||
61 | * a collection of Role models or an array of role names with a "name" key |
||
62 | * |
||
63 | * @param $role |
||
64 | * |
||
65 | * @return boolean |
||
66 | */ |
||
67 | public function hasRole($role) |
||
87 | |||
88 | /** |
||
89 | * Return all of the tenants this user is the owner of |
||
90 | */ |
||
91 | public function owns() |
||
95 | |||
96 | /** |
||
97 | * Return the currently active tenant for this user based on the session |
||
98 | * |
||
99 | * @return BaseTenant |
||
100 | */ |
||
101 | public function activeTenant() |
||
105 | |||
106 | /** |
||
107 | * The tenants relationship |
||
108 | */ |
||
109 | public function tenants() |
||
113 | } |
||
114 |