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_at', |
||
27 | 'phone', |
||
28 | 'phone_verified_at', |
||
29 | 'given_name', |
||
30 | 'family_name', |
||
31 | 'title', |
||
32 | 'organization', |
||
33 | 'country_code', |
||
34 | 'language_code', |
||
35 | 'birthday', |
||
36 | 'gender', |
||
37 | 'social', |
||
38 | 'is_active', |
||
39 | 'last_activity', |
||
40 | 'abilities', |
||
41 | 'roles', |
||
42 | 'tags', |
||
43 | 'tenants', |
||
44 | ]; |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | protected $passwordResetNotificationClass = ManagerPasswordResetNotification::class; |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | protected $emailVerificationNotificationClass = ManagerEmailVerificationNotification::class; |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | protected $phoneVerificationNotificationClass = PhoneVerificationNotification::class; |
||
60 | |||
61 | /** |
||
62 | * Create a new Eloquent model instance. |
||
63 | * |
||
64 | * @param array $attributes |
||
65 | */ |
||
66 | public function __construct(array $attributes = []) |
||
94 | |||
95 | /** |
||
96 | * Attach the given tenants to the model. |
||
97 | * |
||
98 | * @param mixed $tenants |
||
99 | * |
||
100 | * @return void |
||
101 | */ |
||
102 | public function setTenantsAttribute($tenants): void |
||
116 | |||
117 | /** |
||
118 | * Get all attached tenants to the manager. |
||
119 | * |
||
120 | * @return \Illuminate\Database\Eloquent\Relations\MorphToMany |
||
121 | */ |
||
122 | public function tenants(): MorphToMany |
||
127 | |||
128 | /** |
||
129 | * Determine if this is supermanager of the given tenant. |
||
130 | * |
||
131 | * @param \Illuminate\Database\Eloquent\Model $tenant |
||
132 | * |
||
133 | * @return bool |
||
134 | */ |
||
135 | public function isSupermanager(Model $tenant): bool |
||
136 | { |
||
137 | return $this->isManager($tenant) && $this->isA('supermanager'); |
||
138 | } |
||
139 | |||
140 | /** |
||
141 | * Determine if this is manager of the given tenant. |
||
142 | * |
||
143 | * @param \Illuminate\Database\Eloquent\Model $tenant |
||
144 | * |
||
145 | * @return bool |
||
146 | */ |
||
147 | public function isManager(Model $tenant): bool |
||
148 | { |
||
149 | return $this->tenants->contains($tenant); |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * Get the route key for the model. |
||
154 | * |
||
155 | * @return string |
||
156 | */ |
||
157 | public function getRouteKeyName() |
||
161 | } |
||
162 |
It seems like you are assigning to a variable which was imported through a
use
statement which was not imported by reference.For clarity, we suggest to use a different name or import by reference depending on whether you would like to have the change visibile in outer-scope.
Change not visible in outer-scope
Change visible in outer-scope