role) && $authModel->role->value() <= $minRole->value(); } /** * Allow client users associated to the tenant OR admin users. * * @param \App\Models\User $authUser * @return boolean */ public static function restrictTenant(User $authUser): bool { return UserStaticRules::atLeastRole($authUser, UserRolesEnum::client) && \in_array(\tenant()->getKey(), $authUser->tenants->pluck('id')->toArray()) || UserStaticRules::atLeastRole($authUser, UserRolesEnum::admin); } }