isAdmin() || $user->hasPermission('create_user'); } /* * * We need to override as User does not have the company_id property!!!!! * * We use the CompanyUser table as a proxy */ public function edit(User $user, $user_entity) : bool { $company_user = CompanyUser::whereUserId($user_entity->id)->whereCompanyId($user->companyId())->first(); return ($user->isAdmin() && $company_user); } }