简体   繁体   English

错误::! Illuminate\Database\QueryException SQLSTATE[42S02]:找不到基表或视图:1146 表

[英]ERROR!!! Illuminate\Database\QueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table

I ran into an error and I have not figured out how to resolve it alone.我遇到了一个错误,我还没有想出如何单独解决它。 so I opted to get help from this community.所以我选择从这个社区获得帮助。 I will explain a bit though the screenshots are provided.虽然提供了屏幕截图,但我会稍微解释一下。

I created a new laravel project, created a database, users table, connected the env file with the required info, created a factory, seeders with the artisan make: command我创建了一个新的 laravel 项目,创建了一个数据库,用户表,将 env 文件与所需的信息连接起来,创建了一个工厂,使用 artisan make: 命令播种

when I tried generating the fakers with the help of factory and seeders for my student table, after running the command "PHP artisan DB:seed" -> I got the error msg当我尝试在 factory 和 seeders 的帮助下为我的学生表生成伪造者时,在运行命令“PHP artisan DB:seed”后 -> 我收到错误消息

Any help will be appreciated任何帮助将不胜感激

Env File环境文件

Student_Table学生表

Student_Factory学生_工厂

Student_factory学生工厂

Error_msg错误消息

Link Based on error msg链接基于错误消息

Link based on error msg 2链接基于错误消息 2

Link based on error msg 3链接基于错误消息 3

[Link based on error msg 4][9] [链接基于错误消息 4][9]

[Database_seeder file][10] [数据库_种子文件][10]

it looks like the name of student table is different in your migration file, you should use students so Laravel could find the table, if you want to keep your table name student , you should specify that in your model Student .看起来你的迁移文件中学生表的名称不同,你应该使用students这样 Laravel 可以找到该表,如果你想保留你的表名student ,你应该在你的 model Student中指定。

I found in you migration file, the table name was student , not students .我在你的迁移文件中发现,表名是student ,而不是students Change the student to students in your migration file and try again.在您的迁移文件中将students更改为student ,然后重试。

Often, we use plural words as table names, like students , users , admins , products .通常,我们使用复数词作为表名,例如studentsusersadminsproducts

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Illuminate\\Database\\QueryException: SQLSTATE[42S02]: Base table or view not found: 1146 Table (truncated - Illuminate\Database\QueryException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &#03 (truncated Illuminate\Database\QueryException SQLSTATE[42S02]:未找到基表或视图:1146 表 - Illuminate\Database\QueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table Illuminate \\ Database \\ QueryException:SQLSTATE [42S02]:找不到基表或视图 - Illuminate\Database\QueryException: SQLSTATE[42S02]: Base table or view not found Illuminate \\ Database \\ QueryException:SQLSTATE [42S02]:未找到基表或视图:1146表'avatr.apps'不存在(SQL:插入`apps` - Illuminate\Database\QueryException : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'avatr.apps' doesn't exist (SQL: insert into `apps` "Illuminate\\Database\\QueryException 并带有消息“SQLSTATE[42S02]:找不到基表或视图:1146 表“test.people”不存在" - Illuminate\Database\QueryException with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test.people' doesn't exist QueryException SQLSTATE [42S02]:未找到基表或视图:1146表 - QueryException SQLSTATE[42S02]: Base table or view not found: 1146 Table Connection.php第647行中的QueryException:SQLSTATE [42S02]:找不到基表或视图:1146 - QueryException in Connection.php line 647: SQLSTATE[42S02]: Base table or view not found: 1146 SQLSTATE [42S02]:找不到基表或视图:1146 - SQLSTATE[42S02]: Base table or view not found: 1146 QueryException: SQLSTATE[42S02] 未找到基表或视图 - QueryException : SQLSTATE[42S02] Base table or view not found SQLSTATE [42S02]:找不到基表或视图:1146错误laravel - SQLSTATE[42S02]: Base table or view not found: 1146 error laravel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM