将json格式的字段值解析为array.

@param int|array $id    主键或条件.
@param string    $field 字段.

@return array
176893
public final function json_decode($id, $field) {
        $rtn = $this->findOne($id, $field)[ $field ];
        if ($rtn) {
            $rtn = @json_decode($rtn, true);
            if ($rtn) {
                return $rtn;
            }
        }

        return [];
    }
821156
function( json, field, params, callback ){
    field = field || 'id';
    var objectIds = [],
      props;

    if (params.orderByFields && params.orderByFields !== ''){
      var fld = params.orderByFields.split(' ');
      var order = params.orderByFields;
      if (fld[fld.length-1] == 'DESC'){
        order = '-' + params.orderByFields;
      }
      json.features = this.orderBy(json.features, params.orderByFields, order);
    }

    json.features.forEach( function(f){
      props = f.attributes || f.properties;
      objectIds.push( props[ field ] );
    });

    callback( null, {
      objectIdField: field,
      objectIds: objectIds
    });
  }
1144930
public function fromField(Request $request, ModelConfigurationInterface $model, $field, $id = null)
    {
        if (! is_null($id)) {
            $item = $model->getRepository()->find($id);
            if (is_null($item) || ! $model->isEditable($item)) {
                return new JsonResponse([
                    'message' => trans('lang.message.access_denied'),
                ], 403);
            }

            $form = $model->fireEdit($id);
        } else {
            if (! $model->isCreatable()) {
                return new JsonResponse([
                    'message' => trans('lang.message.access_denied'),
                ], 403);
            }

            $form = $model->fireCreate();
        }

        /** @var File $element */
        if (is_null($element = $form->getElement($field))) {
            throw new NotFoundHttpException("Field [{$field}] not found");
        }

        $rules = $element->getUploadValidationRules();
        $messages = $element->getUploadValidationMessages();
        $labels = $element->getUploadValidationLabels();

        /** @var \Illuminate\Contracts\Validation\Validator $validator */
        $validator = Validator::make($request->all(), $rules, $messages, $labels);

        $element->customValidation($validator);

        if ($validator->fails()) {
            return new JsonResponse([
                'message' => trans('lang.message.validation_error'),
                'errors'  => $validator->errors()->get('file'),
            ], 400);
        }

        $file = $request->file('file');

        $filename = $element->getUploadFileName($file);
        $path = $element->getUploadPath($file);
        $settings = $element->getUploadSettings();

        $result = $element->saveFile($file, $path, $filename, $settings);

        /* When driver not file */
        return new JsonResponse($result);
    }
174406
public function map(Field $field)
    {
        $values = array();

        foreach ((array)$field->value as $value) {
            $values[] = (bool)$value;
        }

        return $values;
    }
1284899
public function group($field, $id)
    {
        if (!isset($this->grouped[$field])) {
            foreach ($this->rows as $row) {
                if (!isset($this->grouped[$field][$row->$field])) {
                    $this->grouped[$field][$row->$field] = [];
                }
                $this->grouped[$field][$row->$field][] = $row;
            }
        }
        $origins = isset($this->grouped[$field][$id]) ? $this->grouped[$field][$id] : [];
        return new Rows($origins, $this->getTable(), $this, $this->model);
    }
762759
protected function collectIdsFromField($item, $field)
    {
        $ids = Arr::get($item, $field, []);

        return is_object($ids) && method_exists($ids, 'toArray') ? $ids->toArray() : (array) $ids;
    }
319424
public function removeField($id)
    {
        if (isset($this->_fields[$id])) {
            $name = $this->_fields[$id]->getName();
            unset($this->_fields[$id], $this->_fieldNameMap[$name]);
        }
        return $this;
    }
374529
public function update(array $data, $field, $id)
    {
        $this->applyCriteria();

        /** @var Model $model */
        $model = $this->model->where($field, $id)->first();

        $model->fill($data)->save();

        return $model;
    }
718282
public static function groupBy (string $field, string $order="DESC") : array
	{
		$order = static::validateOrder($order);
		return static::findBySql("SELECT * FROM ".static::$tableName." GROUP BY {$field} ORDER BY id {$order}");
	}
1077513
public function item($id){
		$geo = Geo::find($id);
		$this->applyFilter($geo);
		return \Response::json($geo);
	}
49077
public function getField($id, $field)
    {
        if (!in_array($field, static::$fields)) {
            throw new InvalidArgumentException(sprintf('There is no field named %s.', $field));
        }

        $response = $this->get($this->path.'/'.rawurlencode($id).'/'.rawurlencode($field));

        return isset($response['_value']) ? $response['_value'] : $response;
    }
351341
public function getExistingFields($id, $contentType, $field)
    {
        $query = $this->queryExistingFields($id, $contentType, $field);
        $results = $query->execute()->fetchAll();

        $fields = [];

        if (!$results) {
            return $fields;
        }

        foreach ($results as $result) {
            $fields[$result['grouping']][] = $result['id'];
        }

        return $fields;
    }
458129
public function populateManyRelationByIDs(DataObject $object, $field, $ids = [])
    {
        // Define Relation:
        
        if (!empty($ids)) {
            $this->getRelationList($object, $field)->setByIDList($ids);
        }
        
        // Answer Object:
        
        return $object;
    }
908980
public function getJsonFieldType($field)
    {
        return isset($this->options['field_type'][$field]) ? $this->options['field_type'][$field] : null;
    }
1046809
public function patchUser($id, array $fields)
    {
        $request = $this->client->patch($this->customer['url'].'/api/users/'.$id);

        $request->setAuth($this->customer['username'], $this->customer['password']);
        $request->setBody(json_encode($fields));

        $response = $request->send();

        return json_decode($response->getBody(true));
    }
159646
public function saveField($id, $field, $value) {
		$entity = [
			'id' => $id,
			$field => $value
		];
		return $this->saveArray($entity, ['accessibleFields' => ['id' => true]]);
	}
505628
public function read( $id )
	{
		$this->inital_session_id = $id;
		
		if ( $data = \DB::select( $this->table )->where( 'id', $id )->one( $this->database ) )
		{
			$session_data = unserialize( $data->content );
			
			foreach( $this->index_fields as $field ) 
			{
				$session_data[$field] = $data->$field;
			}
			
			return $session_data;
		}
		
		return array();
	}