GrafiteInc / CMS

Decoupled CMS for any Laravel app, gain control of: pages, blogs, galleries, events, images, custom modules and more.
https://cms.grafite.ca
MIT License
494 stars 104 forks source link

CRUD migration file not created #173

Closed khyoz closed 5 years ago

khyoz commented 6 years ago

Describe the bug php artisan module:crud Toto

To Reproduce Steps to reproduce the behavior:

  1. cmd
  2. execute php artisan module:crud Toto

Expected behavior The migration file is not created, the subdirectory database/migrations does not exist or is not created Illuminate\Filesystem\Filesystem::put("D:\MAMP\htdocs\project/cms/Modules/Totos/Publishes/database/migrations/2018_09_13_181602_create_totos_table.php", "

Screenshots crud2

Solution create manually the subdirectory database/migrations, delete route generated for the module otherwise, content is duplicated with syntax error, and rerun the command Crud, then it works, migration file is created

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

mlantz commented 6 years ago

The module is being generated, but you're missing a couple steps. First creating the module makes it a local copy, you can then run the command artisan module:package to transform it into a packagist package, but lets assume you want to just keep it local. You can run the command artisan module:publish Totos to publish things like the migrations etc to your application where you can then run the migrations, this is also how you will get the routes file to be found.

mlantz commented 6 years ago

Also if you want the module to automatically handle the migrations, you can add that to the module provider $this->loadMigrationsFrom(__DIR__.'/Migrations');

khyoz commented 6 years ago

I did retry with php artisan module:crud to create a new module and everything was there. Now I understand I did try to follow commands and documentation and here are steps to reproduce the same error 1) php artisan module:make X1 (First I want to create a module) 2) php artisan module:crud X1 (Now I want to generate crud)

and you will see the migration is not created and you catch the exception

mlantz commented 6 years ago

These are two separate commands that are not required to go together, they generate two different module types.