public function customFieldsCreate($entity, $customField)
    {
        if (!count($customField) ||
            empty($customField['code']) ||
            empty($customField['name']) ||
            empty($customField['type'])
        ) {
            throw new \InvalidArgumentException(
                'Parameter `customField` must contain a data & fields `code`, `name` & `type` must be set'
            );
        }

        if (empty($entity) || !in_array($entity, ['customer', 'order'])) {
            throw new \InvalidArgumentException(
                'Parameter `entity` must contain a data & value must be `order` or `customer`'
            );
        }

        /* @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            "/custom-fields/$entity/create",
            "POST",
            ['customField' => json_encode($customField)]
        );
    }
public function customFieldsCreate($entity, $customField)
    {
        if (!count($customField) ||
            empty($customField['code']) ||
            empty($customField['name']) ||
            empty($customField['type'])
        ) {
            throw new \InvalidArgumentException(
                'Parameter `customField` must contain a data & fields `code`, `name` & `type` must be set'
            );
        }

        if (empty($entity) || !in_array($entity, ['customer', 'order'])) {
            throw new \InvalidArgumentException(
                'Parameter `entity` must contain a data & value must be `order` or `customer`'
            );
        }

        /* @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            "/custom-fields/$entity/create",
            "POST",
            ['customField' => json_encode($customField)]
        );
    }
public function customFieldsCreate ( $ entity , $ customField ) { if ( ! count ( $ customField ) || empty ( $ customField [ 'code' ] ) || empty ( $ customField [ 'name' ] ) || empty ( $ customField [ 'type' ] ) ) { throw new \ InvalidArgumentException ( 'Parameter `customField` must contain a data & fields `code`, `name` & `type` must be set' ) ; } if ( empty ( $ entity ) || ! in_array ( $ entity , [ 'customer' , 'order' ] ) ) { throw new \ InvalidArgumentException ( 'Parameter `entity` must contain a data & value must be `order` or `customer`' ) ; } /* @noinspection PhpUndefinedMethodInspection */ return $ this -> client -> makeRequest ( "/custom-fields/$entity/create" , "POST" , [ 'customField' => json_encode ( $ customField ) ] ) ; }
Create custom field

@param $entity
@param $customField

@return \RetailCrm\Response\ApiResponse
Create custom field