![当在 Modules/Blog 下删除了文件 module.json 后,生成新的迁移文件:Nwidart\Modules\Exceptions\ModuleNotFoundException : Module [Blog] does not exist!](https://media.shuijingwanwq.com/2023/01/1-3.png)
PS E:\wwwroot\laravel6-modules-demo> php artisan module:make-migration delete_wp_is_default_theme_id_from_theme_saas_task_table Blog
Nwidart\Modules\Exceptions\ModuleNotFoundException : Module [Blog] does not exist!
at E:\wwwroot\laravel6-modules-demo\vendor\nwidart\laravel-modules\src\FileRepository.php:396
392| if ($module !== null) {
393| return $module;
394| }
395|
> 396| throw new ModuleNotFoundException("Module [{$name}] does not exist!");
397| }
398|
399| /**
400| * Get all modules as laravel collection instance.
Exception trace:
1 Nwidart\Modules\FileRepository::findOrFail("Blog")
E:\wwwroot\laravel6-modules-demo\vendor\nwidart\laravel-modules\src\Traits\ModuleCommandTrait.php:16
2 Nwidart\Modules\Commands\MigrationMakeCommand::getModuleName()
E:\wwwroot\laravel6-modules-demo\vendor\nwidart\laravel-modules\src\Commands\MigrationMakeCommand.php:115
Please use the argument -v to see more details.

PS E:\wwwroot\laravel6-modules-demo> php artisan make:migration delete_wp_is_default_theme_id_from_theme_saas_task_table --path=Modules/Blog/Database/Migrations
Created Migration: 2023_01_09_073351_delete_wp_is_default_theme_id_from_theme_saas_task_table
PS E:\wwwroot\laravel6-modules-demo>
PS E:\wwwroot\laravel6-modules-demo> php artisan module:publish-migration Blog
Nwidart\Modules\Exceptions\ModuleNotFoundException : Module [Blog] does not exist!
at E:\wwwroot\laravel6-modules-demo\vendor\nwidart\laravel-modules\src\FileRepository.php:396
392| if ($module !== null) {
393| return $module;
394| }
395|
> 396| throw new ModuleNotFoundException("Module [{$name}] does not exist!");
397| }
398|
399| /**
400| * Get all modules as laravel collection instance.
Exception trace:
1 Nwidart\Modules\FileRepository::findOrFail("Blog")
E:\wwwroot\laravel6-modules-demo\vendor\nwidart\laravel-modules\src\Commands\PublishMigrationCommand.php:32
2 Nwidart\Modules\Commands\PublishMigrationCommand::handle()
E:\wwwroot\laravel6-modules-demo\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
Please use the argument -v to see more details.
/**
*
* @return void
*/
public function register()
{
// ...
$this->registerMigrations();
$this->registerPublishing();
}
/**
* Register the package's migrations.
*
* @return void
*/
private function registerMigrations()
{
if ($this->app->runningInConsole()) {
$this->loadMigrationsFrom(__DIR__.'/../Database/Migrations');
$this->loadFactoriesFrom(__DIR__.'/../Database/factories');
}
}
/**
* Register the package's publishable resources.
*
* @return void
*/
private function registerPublishing()
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../Database/Migrations' => database_path('migrations'),
], 'theme-store-db-migrations');
}
}
E:\wwwroot\laravel6-modules-demo> php artisan migrate
Migrating: 2023_01_09_154319_delete_wp_is_default_theme_id_from_theme_saas_task_table
Migrated: 2023_01_09_154319_delete_wp_is_default_theme_id_from_theme_saas_task_table (0 seconds)
E:\wwwroot\laravel6-modules-demo>
PS E:\wwwroot\object> php artisan migrate
Migrating: 2022_12_20_145928_create_theme_saas_task_table
Migrated: 2022_12_20_145928_create_theme_saas_task_table (0.05 seconds)
Migrating: 2023_01_04_094154_add_from_theme_installation_ids_to_theme_saas_task_table
Migrated: 2023_01_04_094154_add_from_theme_installation_ids_to_theme_saas_task_table (0.04 seconds)
Migrating: 2023_01_09_155849_drop_wp_is_default_theme_id_from_theme_saas_task_table
Migrated: 2023_01_09_155849_drop_wp_is_default_theme_id_from_theme_saas_task_table (0.04 seconds)
PS E:\wwwroot\object>
PHP / Laravel / Yii2 老项目维护与长期技术支持
如果你的 PHP / Laravel / Yii2 项目已经上线,但遇到原开发离职、Bug 长期无人修复、接口不稳定、性能下降、代码难以接手等问题,可以联系我做一次远程技术排查。
适合以下情况:
✅ 老旧 PHP 系统无人维护
✅ Laravel / Yii2 项目 Bug 修复
✅ 后台管理系统小功能迭代
✅ RESTful API 接口排查
✅ MySQL / Redis / Nginx 性能问题
✅ 长期远程兼职维护
可先从一次小问题开始:
✅ 线上报错排查
✅ 接口异常分析
✅ 慢查询与性能瓶颈定位
✅ 代码结构初步评估
✅ 部署环境与日志检查
如需咨询,请联系我,并注明:PHP 维护咨询。
联系方式:
Telegram:@shuijingwan
微信:13980074657
邮箱:shuijingwanwq@gmail.com

发表回复