Laravel:部署时出现迁移错误

Laravel: Migration error on Deploy

我想部署我使用自定义蓝图的项目之一。

php artisan migrate 我收到以下错误:

[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Database\CustomBlueprint' not found

我尝试了 composer dumpautoload 并收到了这条消息:

Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump

You made a reference to a non-existent script @php artisan package:discover

最后一行没有出现在本地环境中。

dumpautoload 之后 migrate 命令产生了相同的结果。

事实上,这实际上取决于您 CustomBlueprint 所在的位置。在错误中有 Database\CustomBlueprint 但请记住 database 目录默认情况下不是 PSR-4 目录。

很可能这足以从您的 CustomBlueprint 的命名空间部分中删除 Database 并在您的迁移中执行相同的操作。