diff --git a/app/Console/Commands/MakeModule.php b/app/Console/Commands/MakeModule.php index e290ddf8db8c..b96cb9ea7674 100644 --- a/app/Console/Commands/MakeModule.php +++ b/app/Console/Commands/MakeModule.php @@ -42,7 +42,7 @@ class MakeModule extends Command $fields = $this->argument('fields'); $migrate = $this->option('migrate'); $lower = strtolower($name); - + // convert 'name:string,description:text' to 'name,description' $fillable = explode(',', $fields); $fillable = array_map(function($item) { @@ -69,10 +69,10 @@ class MakeModule extends Command Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'transformer', '--fields' => $fields]); Artisan::call('ninja:make-class', ['name' => $name, 'module' => $name, 'class' => 'lang', '--filename' => 'texts']); - if ($migrate) { - Artisan::call('module:migrate', ['module' => $name]); - } else { + if ($migrate == 'false') { $this->info("Use the following command to run the migrations:\nphp artisan module:migrate $name"); + } else { + Artisan::call('module:migrate', ['module' => $name]); } Artisan::call('module:dump'); diff --git a/docs/custom_modules.rst b/docs/custom_modules.rst index 7af63622c177..1548d912db8d 100644 --- a/docs/custom_modules.rst +++ b/docs/custom_modules.rst @@ -42,17 +42,18 @@ Run the following command to create a CRUD module: php artisan ninja:make-module Inventory 'name:string,description:text' -You can make adjustments to the migration file and then run: +To edit the migration before it's run add ``--migrate=false`` + +.. code-block:: php + + php artisan ninja:make-module --migrate=false + +After making adjustments to the migration file you can run: .. code-block:: php php artisan module:migrate -To create and migrate in one step add ``--migrate=true`` - -.. code-block:: php - - php artisan ninja:make-module --migrate=true .. Tip:: You can specify the module icon by setting a value from http://fontawesome.io/icons/ for "icon" in modules.json.