kitloong / laravel-migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
2.43k stars 269 forks source link

Run from Controller #190

Closed Jhon-Marulanda closed 9 months ago

Jhon-Marulanda commented 10 months ago

Hello! Can I execute the command php artisan migrate:generate from some controller or trait? I need to be able to do it from the code and not from console, thanks (Laravel 10).

kitloong commented 10 months ago

Hi @Jhon-Marulanda , you could run Artisan::command('migrate:generate') from your controller, I think it should work.

Reference: https://laravel.com/docs/10.x/artisan#closure-commands

Jhon-Marulanda commented 10 months ago

Hi @kitloong, It doesn't work, it doesn't respond, and it doesn't return errors. try doing this with Artisan::call('migrate:generate') But he says he doesn't recognize the command.

kitloong commented 9 months ago

Hi @Jhon-Marulanda I am sorry for being late. May I know if your issue has been resolved?