1 | <?php |
||
14 | class Manager extends User |
||
15 | { |
||
16 | use Tenantable; |
||
17 | |||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | */ |
||
21 | protected $fillable = [ |
||
22 | 'username', |
||
23 | 'password', |
||
24 | 'two_factor', |
||
25 | 'email', |
||
26 | 'email_verified', |
||
27 | 'email_verified_at', |
||
28 | 'phone', |
||
29 | 'phone_verified', |
||
30 | 'phone_verified_at', |
||
31 | 'name_prefix', |
||
32 | 'first_name', |
||
33 | 'middle_name', |
||
34 | 'last_name', |
||
35 | 'name_suffix', |
||
36 | 'title', |
||
37 | 'country_code', |
||
38 | 'language_code', |
||
39 | 'birthday', |
||
40 | 'gender', |
||
41 | 'is_active', |
||
42 | 'last_activity', |
||
43 | 'abilities', |
||
44 | 'roles', |
||
45 | 'tenants', |
||
46 | ]; |
||
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | protected $passwordResetNotificationClass = ManagerPasswordResetNotification::class; |
||
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | protected $emailVerificationNotificationClass = ManagerEmailVerificationNotification::class; |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | protected $phoneVerificationNotificationClass = PhoneVerificationNotification::class; |
||
62 | |||
63 | /** |
||
64 | * Create a new Eloquent model instance. |
||
65 | * |
||
66 | * @param array $attributes |
||
67 | */ |
||
68 | public function __construct(array $attributes = []) |
||
97 | |||
98 | /** |
||
99 | * Attach the given tenants to the model. |
||
100 | * |
||
101 | * @param mixed $tenants |
||
102 | * |
||
103 | * @return void |
||
104 | */ |
||
105 | public function setTenantsAttribute($tenants): void |
||
117 | |||
118 | /** |
||
119 | * Get all attached tenants to the manager. |
||
120 | * |
||
121 | * @return \Illuminate\Database\Eloquent\Relations\MorphToMany |
||
122 | */ |
||
123 | public function tenants(): MorphToMany |
||
128 | |||
129 | /** |
||
130 | * Determine if manager is owner of the given tenant. |
||
131 | * |
||
132 | * @param \Illuminate\Database\Eloquent\Model $tenant |
||
133 | * |
||
134 | * @return bool |
||
135 | */ |
||
136 | public function isOwner(Model $tenant): bool |
||
140 | |||
141 | /** |
||
142 | * Determine if manager is staff of the given tenant. |
||
143 | * |
||
144 | * @param \Illuminate\Database\Eloquent\Model $tenant |
||
145 | * |
||
146 | * @return bool |
||
147 | */ |
||
148 | public function isStaff(Model $tenant): bool |
||
152 | } |
||
153 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.