'SQLSTATE[42S02]: Base table or view not found: 1146 Table '***.indices' doesn't exist laravel

I have table indexpage but still have this error! this is my code:

   public function up()
    {
        Schema::create('index', function (Blueprint $table) {
            $table->increments('id');
            $table->text('about');
            $table->string('video');
            $table->timestamps();
        });
    }

model:

class Index extends Model
{
    protected $fillable = [
        'about' ,'video'
    ];
}

where indices come from?



Solution 1:[1]

By convention, the "snake case", plural name of the class will be used as the table name unless another name is explicitly specified.

In your Index Model, you need to explicitly specified the table name

class Index extends Models {
    protected $table = 'index';
    ...
}

Solution 2:[2]

indices is the plural form of 'index'. By default, laravel will look for a plural form of the model.For example App\User refers to users table. Thats the convention.

'***.indices' not found, but your schema class (migration) is creating a 'index' table.

Add the following in your model. Should work fine.

protected $table = 'index';

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 TsaiKoga
Solution 2 Aryan Ahmed Anik