![](/img/trans.png)
[英]QueryException in Connection.php line 729: SQLSTATE[23000]: Laravel 5.2
[英]Laravel error - QueryException in Connection.php line 729:
收到此错误:
QueryException in Connection.php line 729:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`test`.`projects`, CONSTRAINT `projects_am_id_foreign` FOREIGN KEY (`am_id`) REFERENCES `employees` (`id`)) (SQL: insert into `projects` (`company`, `stage`, `status`, `jira`, `notes`, `updated_at`, `created_at`) values (Test, Waiting for Launch, In Progress, https://www.test.com, Testing, 2017-03-02 14:46:47, 2017-03-02 14:46:47))
项目表 ID公司am_id等
员工表编号名称部门
我在另一个表中有值,所以不确定为什么不能引用它们。 有任何想法吗?
保存项目模型时,请确保已填写am_id。
现在,您正在尝试保存没有填充am_id =>外键错误的Project模型
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.