1

Hello,

How to Create the CRUD operations with Admin Grid in Magento 2.

I want to :-

1.) First of create frontend input form.

2.) frontend input form data get in admin grid.

3.) In admin grid Create delete options.

4.) In admin Grid Create edit(UPDATE) options.

How to achieve this.Please give Best Way and Solution.

THANKS.

3

Create the CRUD operations with Admin Grid in Magento 2

Step-1 : Choose your Module Name like VendoreName and ModuleName

Step-2 : Create a folder like this /app/code/VendoreName/ModuleName

Step-3 : First create registration.php at app/code/VendoreName/ModuleName

Step-4 : Create module.xml at app/code/VendoreName/ModuleName/etc

Step-5 : Choose admin route name and create in routes.xml at app/code/VendoreName/ModuleName/etc/adminhtml

Step-6 : Create on table structure add into InstallSchema.php at app/code/VendoreName/ModuleName/Setup

Step-7 : Create Model files for access your table for DML operation.

Step-8 : Choose admin Conroller name(Index) and create folder like this app/code/VendoreName/ModuleName/Controller/Adminhtml/Index

Step-9 : Create your admin Action file for create admin pages At app/code/VendoreName/ModuleName/Controller/Adminhtml/Index for show grid and manupulate data in admingrid.(Index.php,Add.php,Delete.php,Edit.php,MassDelete.php,MassStatus.php,Save.php)

Step-10: But right now our module is not show. Now Create one menu and add this menu into magento menu list. craete menu.xml at app/code/VendoreName/ModuleName/etc/adminhtml (Menu action must assige carefull like AdminRouteName/AdminControllerName/AtcionFileName)

Step-11: Now we have to create layout at app/code/VendoreName/ModuleName/view/adminhtml/layout (file name must be like this adminroutname_admincontollername_actionfilename.xml all latters are small case and same as you define in file.)

Step-12: You can create grid using Block and Ui-component follow this click here

Step-13: Now admin part is over So create frontend route name routes.xml at app/code/VendoreName/ModuleName/etc/frontend

Step-14: Create Frontend Contoller Name Folder like (Index) like app/code/VendoreName/ModuleName/Controller/Index

Step-15: create action in it as you required. (Index.php,Add.php,Delete.php,Edit.php,MassDelete.php,MassStatus.php,Save.php)

Step-16: create layout for it. layout name must be like this frontendroutename_frontendcontrollername_frontendactionfilename.xml

Step-17: in layout file you call Block and phtml files for show content. click here for more

Step-18: Now your module is ready to use

Please check this all files are created and running well click here to show

Note: you can also use some step before and after as you comfort. but some step are required like route create, layout create etc

I Hope This Helps You

| improve this answer | |
  • Thanks but i want to without module creator. And you explains step create. You only share me steps. Thanks – Mohit Patel Jul 15 at 13:50
  • Yes without any module creator – Mohit Patel Jul 16 at 9:45
  • Thank you . your module All steps is best and i make +1 upvote but your provided module doesn't work. – Mohit Patel Jul 16 at 15:59
  • Sorry, i have find Your module is working perfect. My magento 2 problem.Thanks @Msquare. – Mohit Patel Jul 17 at 4:55
  • and other Please one request check this link and provide debug step . magento.stackexchange.com/q/317559/85907 – Mohit Patel Jul 17 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.