Skip to content
Advertisement

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

I am creating laravel’s registration part. My table name is ‘owner‘ and in code I wrote ‘owner‘ as a table name, but still when I try to submit the registration form I am getting the error page as,

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'engage.owners' doesn't exist (SQL: insert into owners.....

As there is no owners table in my engage database, I don’t know why it’s trying to insert into owners table rather than owner table.

Advertisement

Answer

Accourding to the docs: http://laravel.com/docs/5.1/eloquent

you can change it like this:

namespace App;

use IlluminateDatabaseEloquentModel;

class Flight extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'my_flights';
}

Keep in mind i never worked with laravel.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement