PHP code example of amon / laravel-module-generator
1. Go to this page and download the library: Download amon/laravel-module-generator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bash
# Arbre (Nested Set) : liste indentée, parent différent de soi-même et de ses descendants
php artisan module-generator:make Category --field=name:string --tree
# Polymorphe : select du type puis de l'élément ; colonne affichée par type (name par défaut)
php artisan module-generator:make Comment --field=body:text --morph=commentable --morph-types=Client,Invoice:number
# Module pivot : vrai module reliant deux modèles, unicité du couple
php artisan module-generator:make "Client tag" --pivot-of=Client,Tag --field=note:string:nullable