I want to add an attribute of customer,like phone number,how to add an attribute for primary I find source like this
$eavSetup->addAttribute(
Customer::ENTITY,
'mobile_phone',
[
'group' => 'General',
'type' => 'text',
'label' => 'Mobile Phone',
'input' => 'text',
'source' => '',
'frontend' => '',
'backend' => '',
'required' => false,
'sort_order' => 66,
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
'is_used_in_grid' => false,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => false,
'visible' => true,
'is_html_allowed_on_front' => true,
'visible_on_front' => true
]
);
$CustomerAttribute = $this->eavConfig->getAttribute(Customer::ENTITY, 'mobile_phone');
$CustomerAttribute ->addData(
[
'attribute_set_id' => $attributeSetId,
'attribute_group_id' => $attributeGroupId,
'used_in_forms' => ['adminhtml_customer', 'customer_account_create']
]
);
but it doesn't primary attribute