Bappa sarkar
Bappa sarkar

Reputation: 326

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. I I can't understand why.

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

This query is running in migration period.

Upvotes: 1

Views: 5177

Answers (3)

Eng Majid khan
Eng Majid khan

Reputation: 1

Please check your validation properly eg 'tag' => 'required|unique:tag|max:255' error 'tag' => 'required|unique:tags|max:255' correct

Upvotes: 0

Bappa sarkar
Bappa sarkar

Reputation: 326

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.

Upvotes: 6

Winnipass
Winnipass

Reputation: 950

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

Upvotes: 1

Related Questions