且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

迁移时未找到Laravel致命错误类

更新时间:2023-11-16 20:12:52

我通过

  1. 删除所有迁移
  2. 运行composer dump-autoload
  3. 将它们一个接一个地添加并运行php artisan migrate
  4. 删除导致Laravel引发错误的内容
  5. 创建新迁移以替换已删除的迁移
  1. Removing all migration
  2. Running composer dump-autoload
  3. Adding them back one by one and running php artisan migrate
  4. Deleting those that caused Laravel to throw an error
  5. Create new migrations to replace the deleted ones

我不确定为什么能奏效,但我想过去我可能已经修改了这些有问题的迁移的类名.

I'm not sure why that worked but my guess is that I might have modified the class name of these problematic migrations in the past.

我还发现,使用迁移的初始名称(致命错误引发的迁移)重命名迁移同样适用于其中一些.

I also found that renaming the migration with its initial name (The one throwed with the fatal error) also works for some of them.