简体   繁体   中英

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

My project was running well. After adding 3 new columns to a table, I run a artisan command

php artisan migrate:refresh

But action did not complete. After that, when I run any migration command, it is throwing an error massage .

[Illuminate\\Database\\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'telemedicine.users' doesn't exist (SQL: select * from users where status = 0 and mailconfirm = 1)

Note:

I deleted all tables and run php artisan migration But the problem remains. II can't understand why.

(SQL: select * from `users` where `status` = 0 and `mailconfirm` = 1)

This query is running in migration period.

Thank you Everybody. I have already solved my problem. I used a function getAllinactiveUsers in boot function of AppServiceprovider class . The dafination of getAllinactiveUsers function was written in the Model Class . So when I tried to run php artisan command to create table in the phpMyadmin , The getAllinactiveUsers was invoked before creating the table. For this reason such Error was throwing.

Solution: 

Just commented The getAllinactiveUsers function from AppServiceprovider class , and run php artisan command. Everything is ok.

Try adding the name of the tables to your Model Class. public $table = "users";

请正确检查您的验证,例如'tag'=>'required | unique:tag | max:255'错误'tag'=>'required | unique:tags | max:255'正确

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM