getEntityType(); return $user->hasPermission('edit_' . $entityType) || $user->owns($item); } /** * @param User $user * @param $item - entity name or object * @return bool */ private static function checkModuleEnabled(User $user, $item) { $entityType = is_string($item) ? $item : $item->getEntityType(); return $user->account->isModuleEnabled($entityType); } private static function className($entityType) { if (! Utils::isNinjaProd()) { if ($module = \Module::find($entityType)) { return "Modules\\{$module->getName()}\\Policies\\{$module->getName()}Policy"; } } $studly = Str::studly($entityType); return "App\\Policies\\{$studly}Policy"; } }