Your IP : 216.73.216.220


Current Path : /var/www/html/app/code/FlipsDigital/EducationInstitution/Setup/
Upload File :
Current File : /var/www/html/app/code/FlipsDigital/EducationInstitution/Setup/UpgradeData.php

<?php
/**
 * InstallData
 *
 * @copyright Copyright © 2021 FlipsDigital. All rights reserved.
 * @author    calvin.so@flipsdigital.com
 */

namespace FlipsDigital\EducationInstitution\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;
use Magento\Framework\Setup\UpgradeDataInterface;
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;

/**
 * @codeCoverageIgnore
 */
class UpgradeData implements UpgradeDataInterface
{
    /**
     * EducationInstitution setup factory
     *
     * @var EducationInstitutionSetupFactory
     */
    protected $educationinstitutionSetupFactory;

    /**
     * Init
     *
     * @param EducationInstitutionSetupFactory $educationinstitutionSetupFactory
     */
    public function __construct(EducationInstitutionSetupFactory $educationinstitutionSetupFactory)
    {
        $this->educationinstitutionSetupFactory = $educationinstitutionSetupFactory;
    }

    public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) {
        $setup->startSetup();

        if (version_compare($context->getVersion(), '0.0.12', '<')) {
            $eavSetup = $this->educationinstitutionSetupFactory->create(['setup' => $setup]);
            $eavSetup->addAttribute(
                \FlipsDigital\EducationInstitution\Model\EducationInstitution::ENTITY,
                'school_remark',
                [
                    'type' => 'text',
                    'label' => 'School Remark',
                    'input' => 'textarea',
                    'required' => true,
                    'sort_order' => 100,
                    'global' => ScopedAttributeInterface::SCOPE_STORE,
                    'group' => 'General',
                    'wysiwyg_enabled' => true,
                ]
            );
        }

        $setup->endSetup();
    }
}