'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

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

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

Link based on error msg 3

[Link based on error msg 4][9]

[Database_seeder file][10]



Solution 1:[1]

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.

Solution 2:[2]

I found in you migration file, the table name was student, not students. Change the student to students in your migration file and try again.

Often, we use plural words as table names, like students, users, admins, products.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mehdi Aroui
Solution 2 shrekuu