I'm trying to add custom text box named cashback in Magento 2 product add/edit page. I added the text box programmatically. But my below code doesn't add column in the table also not saving the value. I'm a beginner so I can't understand Magento 2 structure. I need clarification about which table does it stores and need to store data given in admin panel.
<?php
namespace Rk\Wallet\Setup;
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
private $eavSetupFactory;
public function __construct(
EavSetupFactory $eavSetupFactory
)
{
$this->eavSetupFactory = $eavSetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
"cashback",
[
'group' => "",
'label' => "Cashback",
'is_html_allowed_on_front' => true,
'default' => '1',
'note' => '',
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => true,
'searchable' => true,
'filterable' => true,
'comparable' => false,
'visible_on_front' => true,
'visible_in_advanced_search' => false,
'unique' => false,
"frontend_class" => "cashbackclass",
"used_in_product_listing" => true,
"type" => "int",
"input" => "text",
"type" => "int",
"source" => "Vendor\Module\Model\Config\Source\TimeSetup",
'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\ArrayBackend'
]
);
}
}