Devise\Pages\Fields\FieldManager::resetField PHP Method

resetField() public method

Reset field values
public resetField ( integer $fieldId, $scope ) : DvsField
$fieldId integer
return DvsField | \DvsGlobalField
    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;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Resets a fields values
  *
  * @param  integer $fieldId
  * @return json
  */
 public function requestReset($fieldId, $scope)
 {
     $field = $this->Manager->resetField($fieldId, $scope);
     return $field;
 }