我正在创建 laravel 的注册部分。我的表名称是“owner
”,在代码中我写了“owner
”作为表名称,但当我尝试提交注册表单时,我仍然收到错误页面作为,
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'engage.owners' doesn't exist (SQL: insert into owners.....
由于我的 engage
数据库中没有 owners
表,我不知道为什么它尝试插入 owners
表而不是所有者
表。
最佳答案
根据文档:http://laravel.com/docs/5.1/eloquent
你可以这样改变它:
命名空间应用程序;
使用 Illuminate\Database\Eloquent\Model;
class Flight extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'my_flights';
}
请记住,我从未使用过 Laravel。
关于php - SQLSTATE[42S02] : Base table or view not found: 1146 Table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33367409/