public function resetField($fieldId, $scope) { $field = $scope === 'global' ? $this->GlobalField->findOrFail($fieldId) : $this->Field->findOrFail($fieldId); $field->json_value = '{}'; $field->values->override([]); $field->save(); return $field; }
/** * Resets a fields values * * @param integer $fieldId * @return json */ public function requestReset($fieldId, $scope) { $field = $this->Manager->resetField($fieldId, $scope); return $field; }