Here is a Sample Plugin with a Custom payment gateway implemented, you can explore it to understand how it actually works
https://github.com/xgenious-official/nazmart-plugin-sample
Create a module using this artisan
command
php artisan module:make YourModuleName
Add the module name in your modules_statuses.json file. The file is located in the core directory of the script.
![](https://docs.xgenious.com/wp-content/uploads/2023/03/image-11.png)
In the modules_statuses.json file
{
"Blog": true,
"Service": true,
"YourModuleName": true
}
modules_statuses.json file looks like this
![](https://docs.xgenious.com/wp-content/uploads/2023/03/image-12.png)
You will get the module inside the Modules directory which you have just created. The Modules is located inside the core directory after the script root directory,
![](https://docs.xgenious.com/wp-content/uploads/2023/03/image-13.png)
For more details about Module, you can check out this repository,
https://github.com/nWidart/laravel-modules
![](https://docs.xgenious.com/wp-content/uploads/2023/03/image-14-1024x512.png)
Define plugin type
Add external as plugin_type,
"plugin_type": "external"
Add your custom sidebar menu in the admin panel
To add a custom menu, add this code to your module.json file. The module.json file is located inside the module you are dealing with,
"admin_settings": {
"menu_item": [
]
}
The module.json file looks like this,
{
"name": "TestManage",
"alias": "testmanage",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\TestManage\\Providers\\TestManageServiceProvider"
],
"aliases": {},
"files": [],
"requires": [],
"nazmartMetaData": {
"plugin_type": "external",
"style": [],
"admin_settings": {
"show_admin_landlord": true,
"show_admin_tenant": true,
"menu_item": [
{
"id" : "test-settings-menu",
"label": "Test Menu",
"route": "tenant.admin .newsletter",
"parent": null,
"permissions": "testmanage",
"icon": "mdi mdi-settings",
"class": "any-class"
},
{
"id" : "test-settings-menu-submenu",
"label": "Test Sub Menu",
"route": "tenant.admin.activity.log",
"parent": "test-settings-menu",
"permissions": ["test-settings-page-settings"]
}
]
},
"header_hook": [],
"footer_hook": [],
"pageBuilderAddon": [
"Modules\\TestManage\\Http\\PageBuilder\\Addons\\TestAddon"
],
"widgetBuilderAddon": [
"Modules\\TestManage\\Http\\WidgetBuilder\\Widgets\\FooterAbout"
],
"paymentGateway": {
"name": "AliPay",
"slug": "alipay",
"tenant": false,
"chargeCustomerMethodNameSpace": "Modules\\TestManage\\Http\\Controllers\\TestManageController",
"chargeCustomerMethodName": "paymentGateway",
"test_mode" : false,
"status" : true,
"extraInfoMarkupBlade" : "ali_pay",
"logo_file" : "ali-pay.png"
}
}
}
Add your menu id, label, route, permissions and icon in the menu_item
,
![](https://docs.xgenious.com/wp-content/uploads/2023/08/image-26.png)
If you want to create a sub-menu follow the procedure,
![](https://docs.xgenious.com/wp-content/uploads/2023/08/image-27.png)
![](https://docs.xgenious.com/wp-content/uploads/2023/08/image-28.png)