SQLSTATE[42S02]:未找到基表或视图:Laravel

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40970860/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 14:52:31  来源:igfitidea点击:

SQLSTATE[42S02]: Base table or view not found: Laravel

phphtmlmysqllaravel

提问by Lois Arce

QueryException in Connection.php line 769: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'hmsdb.customers' doesn't exist (SQL: insert into customers(lastName, firstName, middleName, address, telephone, mobile, notes, updated_at, created_at) values (Arce, Johanna, , ds, N/A, ds, ew, 2016-12-05 09:20:18, 2016-12-05 09:20:18))

Connection.php 第 769 行中的 QueryException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'hmsdb.customers' does not exist (SQL: insert into customers( lastName, firstName, middleName, address, telephone, mobile, notes, updated_at, created_at) values (Arce,约翰娜, , ds, N/A, ds, ew, 2016-12-05 09:20:18, 2016-12-05 09:20:18))

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'hmsdb.customers' doesn't exist

SQLSTATE[42S02]:未找到基表或视图:1146 表“hmsdb.customers”不存在

The name of the column should be customer and i don't where how to change hmsdb.customers to hmsdb.customer

列的名称应该是 customer,我不知道如何将 hmsdb.customers 更改为 hmsdb.customer

回答by Amit Sahu

In your customer model change to it like protected $table = 'customer';Hope it will help you :)

在您的客户模型中更改为它protected $table = 'customer';希望它会帮助您:)

回答by poncho1987

If you have located the migration of the table in a specific folder, you must indicate the path and then add the command --seed to execute the filling of your table.

如果您已将表的迁移定位在特定文件夹中,则必须指明路径,然后添加命令--seed 来执行表的填充。

example: php artisan migrate --path=database/migrations/your_migration.php --seed

示例:php artisan migrate --path=database/migrations/your_migration.php --seed

回答by rupesh

check your table name. its showing error as table not found there is spelling mistake

检查您的表名。它显示错误,因为找不到表,有拼写错误