A Laravel Nova Tool helping modularize your application. Often happens that our applications grow a lot and we need a lot of models, resources, lenses, actions, migrations etc.. With this package we can divide our nova parts in little chunks (or modules).
To start you just need to install the composer package
composer require mycmdev/nova-modules
In our composer.json we have to add
"autoload": {
"psr-4": {
"NovaModules\\": "nova-modules/"
}
},
"nova-modules" and "NovaModules" are the default folder and default namespace for the package, but you can change it publishing the config file with the command:
php artisan vendor:publish --tag=nova-modules
and changing it on:
'path' => 'nova-modules',
'namespace' => 'NovaModules'
now we just need to type the command:
php artisan nova-modules:make {name of our module}
and our module will be autocreated with all his subfolders.
So we'll have a structure like this :
NovaModules has an artisan command for almost everything we need:
For creating new action
php artisan nova-modules:action {action-name} {module-name}
For creating new card
note: it will create a folder in our assets with the Vue file so we can integrate it in our main JS file
php artisan nova-modules:card {card-name} {module-name}
For creating new custom filter
note: this one as well will create a folder in our assets with the Vue file
php artisan nova-modules:custom-filter {custom-filter-name} {module-name}
For creating new dasboard
php artisan nova-modules:dashboard {dashboard-name} {module-name}
For creating a new Field
note: this one will create the 3 different Vue files for each view in our nova application.
php artisan nova-modules:field {field-name} {module-name}
For creating a new filter
php artisan nova-modules:filter {filter-name} {module-name}
For creating a new lens
php artisan nova-modules:lens {lens-name} {module-name}
For creating a migration
php artisan nova-modules:migration {migration-name} {module-name}
For creating a new model
php artisan nova-modules:model {model-name} {module-name}
For creating a new partition metric
php artisan nova-modules:partition {partition-name} {module-name}
If we need to integrate another service provider in our module
note: you need to register it in your main module service provider.
php artisan nova-modules:provider {provider-name} {module-name}
For creating a new resource
note: resources are all auto loaded in your main application and they are grouped by default with the name of your module.
php artisan nova-modules:resource {resource-name} {module-name}
For creating a new resource-tool
note: this will create as weel Vue file inside your assets folder.
php artisan nova-modules:resource-tool {resource-tool-name} {module-name}
For creating a new tool connected with your module
note: this will create Vue file inside your assets folder as well a navigation.blade inside the Assets/views folder .
I don't know if maybe in a future release i will add a system for autoloading
php artisan nova-modules:tool {tool-name} {module-name}
For creating a new trend metric
php artisan nova-modules:trend {trend-name} {module-name}
For creating a new value metric
php artisan nova-modules:value {value-name} {module-name}
For creating a new policy
php artisan nova-modules:policy {policy-name} {module-name}
I would like to thank @nWidart for giving me the idea about modular laravel application with his great package nwidart/laravel-modules
The MIT License (MIT). Please see License File for more information.