diff --git a/src/Repositories/Behaviors/HandleUserPermissions.php b/src/Repositories/Behaviors/HandleUserPermissions.php index a58f8de1f..3218e054b 100644 --- a/src/Repositories/Behaviors/HandleUserPermissions.php +++ b/src/Repositories/Behaviors/HandleUserPermissions.php @@ -25,6 +25,11 @@ public function getFormFieldsHandleUserPermissions($object, $fields) foreach ($object->permissions()->moduleItem()->get() as $permission) { $model = $permission->permissionable()->first(); + + if ($model === null) { + continue; + } + $moduleName = getModuleNameByModel($model); $fields[$moduleName . '_' . $model->id . '_permission'] = $permission->name; }