I am creating customer attribute but getting error run while setup upgrade command
Wrong attribute group ID
here is my code for create customer attribute
<?php
namespace Vendor\CustomerFeedBack\Setup;
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Customer\Api\CustomerMetadataInterface;
use Magento\Customer\Setup\CustomerSetupFactory;
/**
* @codeCoverageIgnore
*/
class UpgradeData implements UpgradeDataInterface
{
/**
* EAV setup factory
*
* @var EavSetupFactory
*/
private $eavSetupFactory;
private $eavConfig;
private $customerSetupFactory;
/**
* Init
*
* @param EavSetupFactory $eavSetupFactory
*/
public function __construct(EavSetupFactory $eavSetupFactory,\Magento\Eav\Model\Config $eavConfig,CustomerSetupFactory $customerSetupFactory){
$this->eavSetupFactory = $eavSetupFactory;
$this->eavConfig = $eavConfig;
$this->customerSetupFactory = $customerSetupFactory;
}
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context){
/** @var EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.0.1') < 0) {
$customerSetup = $this->customerSetupFactory->create(['setup' => $setup]);
$customerSetup->addAttribute(\Magento\Customer\Model\Customer::ENTITY, 'customer_feedback', [
'label' => 'Referral Sources',
'input' => 'text',
'type' => 'varchar',
'source' => '',
'required' => false,
'position' => 0,
'visible' => true,
'system' => false,
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => true,
'backend' => ''
]);
$attribute = $customerSetup->getEavConfig()->getAttribute('customer', 'customer_feedback')
->addData(['used_in_forms' => [
'adminhtml_customer'
]]);
$attribute->save();
}
}
}
can anyone help me with same...
Magento version 2.2.6