Context:
I use this laravel modules package: https://github.com/nWidart/laravel-modules
I created different modules, and every module does have its migration with its different database connection.
I need to execute all modules migrations but I do not need to execute laravel migration.
What I did is creating a app:migrate-modules
command that loops the modules and for each modules executes its migrations.
This code:
$databaseConnection = config($module->getLowerName().'.database_connection');
if (! empty($databaseConnection)) {
Artisan::call("module:migrate $module --force --database=$databaseConnection");
}
Other than that, I disabled laravel migrate command with this code (I do not want to execute laravel migrate command, cause my project does not have default database connection):
Artisan::command('migrate', function () {
$this->comment('Command NOT AVAILABLE. Use this: php artisan app:migrate-modules');
});
My problem is that with this overwrite, also my command does not work, cause package migrate
command calls laravel migrate
command.
How can I disable laravel migrate command but still use migrate for all modules?