Laravel迁移:“找不到ERROR类”

时间:2020-11-07 09:38:19

标签: php mysql laravel migration

我是Laravel的新手,我正在构建一个包含五个表的小项目:用户,产品,类别,交易和数据透视表category_product。当我尝试运行命令时 Php artisan migrate 我收到错误找不到“交易”类

这是表格。

用户表

enter image description here

重置密码表

enter image description here

产品表

enter image description here

类别表

enter image description here

交易记录表

enter image description here

类别产品表

enter image description here

**迁移文件夹中的迁移顺序**

enter image description here

这是我收到的完整错误

enter image description here

2 个答案:

答案 0 :(得分:3)

laravel从迁移文件名获取迁移类名称,以解决此问题:

1-将文件2020_11_06_transactions重命名为2020_11_06_create_transactions_table

2-{{​​1}}

3-composer dumpautoload

答案 1 :(得分:1)

  1. 首先将事务的文件名从<footer> <div id="root">Click HERE</div> <div id="count"></div> </footer>更改为2020_11_06_200236_transactions.php

  2. 运行命令以刷新以前运行的迁移:

2020_11_06_200236_create_transactions_table.php