2016-12-07 22:16:11 +01:00
|
|
|
Custom Modules
|
|
|
|
==============
|
|
|
|
|
|
|
|
Invoice Ninja support customs modules using https://github.com/nWidart/laravel-modules
|
|
|
|
|
2016-12-12 22:42:54 +01:00
|
|
|
You can watch this `short video <https://www.youtube.com/watch?v=8jJ-PYuq85k>`_ for a quick overview of the feature.
|
|
|
|
|
2016-12-07 22:16:11 +01:00
|
|
|
Install Module
|
|
|
|
""""""""""""""
|
|
|
|
|
|
|
|
To install a module run:
|
|
|
|
|
2016-12-07 22:17:28 +01:00
|
|
|
.. code-block:: php
|
2016-12-07 22:16:11 +01:00
|
|
|
|
|
|
|
php artisan module:install <vendor/module> --type=github
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
2016-12-07 22:17:28 +01:00
|
|
|
.. code-block:: php
|
2016-12-07 22:16:11 +01:00
|
|
|
|
|
|
|
php artisan module:install invoiceninja/sprockets --type=github
|
|
|
|
|
|
|
|
You can check the current module status with:
|
|
|
|
|
2016-12-07 22:17:28 +01:00
|
|
|
.. code-block:: php
|
2016-12-07 22:16:11 +01:00
|
|
|
|
|
|
|
php artisan module:list
|
|
|
|
|
|
|
|
|
|
|
|
Create Module
|
|
|
|
"""""""""""""
|
|
|
|
|
2016-12-09 13:18:22 +01:00
|
|
|
Run the following command to create a CRUD module:
|
2016-12-07 22:16:11 +01:00
|
|
|
|
2016-12-07 22:17:28 +01:00
|
|
|
.. code-block:: php
|
2016-12-07 22:16:11 +01:00
|
|
|
|
2016-12-09 13:23:24 +01:00
|
|
|
php artisan ninja:make-module <module> <fields>
|
|
|
|
|
|
|
|
.. code-block:: php
|
|
|
|
|
|
|
|
php artisan ninja:make-module Inventory 'name:string,description:text'
|
2016-12-07 22:16:11 +01:00
|
|
|
|
2016-12-13 11:51:13 +01:00
|
|
|
To edit the migration before it's run add ``--migrate=false``
|
2016-12-09 13:10:46 +01:00
|
|
|
|
|
|
|
.. code-block:: php
|
|
|
|
|
2016-12-13 11:51:13 +01:00
|
|
|
php artisan ninja:make-module <module> <fields> --migrate=false
|
2016-12-09 13:10:46 +01:00
|
|
|
|
2016-12-13 11:51:13 +01:00
|
|
|
After making adjustments to the migration file you can run:
|
2016-12-09 13:10:46 +01:00
|
|
|
|
|
|
|
.. code-block:: php
|
|
|
|
|
2016-12-13 11:51:13 +01:00
|
|
|
php artisan module:migrate <module>
|
|
|
|
|
2016-12-07 22:16:11 +01:00
|
|
|
|
|
|
|
.. Tip:: You can specify the module icon by setting a value from http://fontawesome.io/icons/ for "icon" in modules.json.
|
|
|
|
|
|
|
|
Share Module
|
|
|
|
""""""""""""
|
|
|
|
|
|
|
|
To share your module create a new project on GitHub and then commit the code:
|
|
|
|
|
2016-12-07 22:17:28 +01:00
|
|
|
.. code-block:: php
|
2016-12-07 22:16:11 +01:00
|
|
|
|
|
|
|
cd Modules/<module>
|
|
|
|
git init
|
|
|
|
git add .
|
|
|
|
git commit -m "Initial commit"
|
|
|
|
git remote add origin git@github.com:<vendor/module>.git
|
|
|
|
git push -f origin master
|
|
|
|
|
|
|
|
.. Tip:: Add ``"type": "invoiceninja-module"`` to the composer.json file to help people find your module.
|
|
|
|
|
2016-12-07 22:17:28 +01:00
|
|
|
Finally, submit the project to https://packagist.org.
|