Eloquent 默认属性值为 0 的时候,报错问题。
问题
eloquent 模型 item.php 里面已经设置了默认属性,但是为什么在post数据中不填写相应的字段,会报错呢?
默认值,报错如下图:
QueryException In Connection.php line 664 :
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'cate_id' at row 1 (SQL: insert into `items` (`cate_id`, `url`, `judge_id`, `owner_one`, `owner_two`, `is_multi`, `status`, `owner`, `title`, `school`, `updated_at`, `created_at`) values (, , , , , 1, 1, 哈哈,呵呵, 测试, 哈哈, 2019-10-14 10:38:44, 2019-10-14 10:38:44))
推荐文章: