2.5 (49.41%) 17 votes

Here are the steps that you will follow in this How to Register a module and Create Database in Magento 2:

  1. Step 1: Define some basic information about the module
  2. Step 2:  In our module all source code will located at: app/code/Magestore/Company.
  3. Step 3: Now we start by create two file in app/code/Magestore/Company folder
  4. Step 4: create routes.xml in app/code/Magestore/etc/adminhtml
  5. Step 5: create InstallSchema.php in app/code/Magestore/Setup folder
  6. Step 6: update project by command-line

 How to Register a module and Create Database in Magento 2

  • In this series, I will guide you to create a full admin module of Magento 2 with basic function: listing, edit, add new, filter, export, delete.
  • We also will using a new type of UI that Magento 2 produce: UI component.
  • The business context of this module is: I am going to write a module to manage my company staffs. So in this tutorial, I’ll guide you to create a part of module to list, add new, edit, delete… the information of staffs.

Step 1: Define some basic information about the module

  • In Magento 2, we put all of our module code into app/code/your_company_name/your_module_name
  • But if you install a module with composer, all code will be located at:

app/vendor/your_company_name/your_module_name

Step 2: In our module all source code will located at: app/code/Magestore/Company.

app/code/Magestore/Company

Step 3: Now we start by create two file in app/code/Magestore/Company folder:

  • Composer.json and registration.php
  • Composer.json

  • Registration.php

Step 4: Create routes.xml in app/code/Magestore/etc/adminhtml

app/code/Magestore/etc/Adminhtml/routes.xml

Step 5: Create InstallSchema.php in app/code/Magestore/Setup folder
app/code/Magestore/Setup/InstallSchema.php

Step 6: Update project by command-line

  • Open terminal and run a command-line to upgrade the project.

Your Magento website needs a powerful Magento ERP for stock control.

DON'T MISS THE CHANCE!

magento erp

Clear Directories during Development in Magento 2 - Magento 2.3
Prompt Widget in Magento 2 - Magento 2.3

Leave a Reply

Your email address will not be published. Required fields are marked *