更新时间:2023-11-17 17:55:28
从这些文件中删除从模型中请求数据的任何行,以确保工匠不会尝试从不存在的表中加载数据:
Remove any lines requesting data from your model from these files to be sure artisan is not trying to load data from your non-existent table:
bootstrap/start.php
app/start/global.php
app/start/local.php
app/routes.php
bootstrap/start.php
app/start/global.php
app/start/local.php
app/routes.php
还请确保在app/config/app.php
内部的注册或引导方法中注销使用该表中数据的所有服务提供商.
Also be sure to un-register any service providers that utilize data from that table in their register or boot methods inside of app/config/app.php
.
问题在于,这些文件不仅会针对浏览器(web)请求执行,还会针对所有请求(包括命令行工匠调用(例如php artisan migrate
))执行.因此,如果您尝试在任何这些文件中使用某些东西之前就使用它,那么您将度过一段艰难的时光.
The issue is that these files not only get executed for browser (web) requests, but for all requests, including command-line artisan invocations (e.g. php artisan migrate
). So if you try to use something before it is available in any of these files, you are going to have a Bad Time.