'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'iop.servicecategories' doesn't exist (SQL: select * from `servicecategories`)

i have a problem with this error so there are my table and modelenter image description here

enter image description here

i try to put this in my model: protected $table = 'servicecategories';

but the problem is not solved. also try to clear cache and delete table but the problem is not solved, also if i try to make a simple php artisan



Solution 1:[1]

In your migration you are using a common class, but Laravel uses anonymous classes. On class CreateServicecategoriesTable extends Migration { you should replace with return new class extends Migration {.

Solution 2:[2]

Please run command => php artisan migrate

Solution 3:[3]

In db ..Your table name is different from your class name. I think they both should be the same I think this is the problem .. When you run php artisan migrate works?

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 Lucas
Solution 2 venkata sudheer
Solution 3 Alya Al Siyabi