简体   繁体   English

未找到列:“字段列表”中的 1054 列“type_id”未知

[英]Column not found: 1054 Unknown column 'type_id' in 'field list'

I get this error when i tried to compile the controller of a class named Type in which i tried to create a classs called Compte, the relation is One type to Many compte.当我尝试编译名为 Type 的类的控制器时出现此错误,我试图在该类中创建一个名为 Compte 的类,关系是一种类型到许多类型。 Column not found: 1054 Unknown column 'type_id' in 'field list' (SQL: insert into comptes ( password , type_id , updated_at , created_at ) values (hhh, 1, 2021-10-15 18:16:49, 2021-10-15 18:16:49))未找到列:1054 '字段列表'中的未知列'type_id'(SQL:插入comptespasswordtype_idupdated_atcreated_at )值(hhh,1,2021-10-15 18:16:49,2021-10) -15 18:16:49))

The type_id does not exist in my code: enter image description here type_id 在我的代码中不存在:在此处输入图像描述

“type_id”不是您要插入的数据库表中的列。

那是因为您的数据库表中没有名为type_id列。

在编写代码时,您为表定义了id_type列,但您尝试将数据插入不存在的type_id列!

Add field name in model like protected $fillable = ['type_id',....];在模型中添加字段名称,如protected $fillable = ['type_id',....]; Or remove protected $fillable from model then all fields available for fillable或者从模型中删除受保护的 $fillable 然后所有可用于填充的字段

You create column name id_type in the database, but in the model, you named it id_type need to fix it in the data.您在数据库中创建列名id_type ,但在模型中,您将其命名为id_type需要在数据中修复它。

图片

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQLSTATE [42S22]:未找到列:1054 Laravel 4 中“字段列表”中的未知列“id” - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'field list' in laravel 4 未找到列:1054“字段列表”中的未知列“taggables.tags_model_id” laravel eloquent - Column not found: 1054 Unknown column 'taggables.tags_model_id' in 'field list' laravel eloquent SQLSTATE [42S22]:未找到列:1054 '字段列表'中的未知列 'id' - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'field list' SQLSTATE [42S22]:找不到列:1054“字段列表”中的未知列“ projects_id” - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'projects_id' in 'field list' 找不到列:1054'字段列表'中的未知列'category_ids' - Column not found: 1054 Unknown column 'category_ids' in 'field list' 未找到Zend列:1054“字段列表”中的未知列“ 0” - Zend Column not found: 1054 Unknown column '0' in 'field list' 未找到列:1054“字段列表”中的未知列“徽标” - Column not found: 1054 Unknown column 'logo' in 'field list' 未找到列:1054 Laravel“字段列表”中的未知列“_token” - Column not found: 1054 Unknown column '_token' in 'field list' Laravel 找不到列:1054'字段列表'laravel中的未知列'0' - Column not found: 1054 Unknown column '0' in 'field list' laravel 未找到列:1054'字段列表'中的未知列'图像' - Column not found: 1054 Unknown column 'image' in 'field list'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM