-
Notifications
You must be signed in to change notification settings - Fork 0
Creating modules
Modules in Mconsole are micro Laravel applications and have their own resources (controllers, routes, views, models, etc.). Mconsole installation requires only milax/mconsole-base-components package, wich have two modules News and Pages.
There are 3 module types:
- base - module installed from package manager
- custom - module created within laravel project
- extended - module installed from package manager and extended by custom module
To create new custom module install Mconsole and then call artisan command: php artisan make:module {ClassName} - this command will create module inside /app/Mconsole/ directory.
If you wish to extend base module (for example Pages or News) use module name as class name: php artisan make:module Page.
To develop module package run: php artisan make:module --package, this will create module in /workbench directory, set namespaces to Milax\Mconsole instead of App\Mconsole, and generates composer.json inside module directory.
Here an example structure of module called Test:
└── Test
├── assets
│ ├── config
│ ├── migrations
│ ├── public
│ │ ├── css
│ │ ├── img
│ │ └── js
│ └── resources
│ ├── lang
│ │ ├── en
│ │ └── ru
│ └── views
├── bootstrap.php (required)
├── Http
│ ├── Controllers
│ │ └── TestController.php
│ └── routes.php
├── Installer.php
├── Models
└── Provider.php
-
bootstrap.phpis required, it contains all module info -
assets/public/\*/you can store any assets structure, they all will be copied in/massets/modules/Test/*/directory -
Installer.phpis optional file, usually we use it as settings seeder -
Provider.phpit's a Laravel Service Provider