Php Laravel Voyager SQLSTATE[HY000]:一般错误:1364字段';id';不';没有默认值
我在后台使用voyager作为管理面板,在创建面包时遇到这种类型的错误Php Laravel Voyager SQLSTATE[HY000]:一般错误:1364字段';id';不';没有默认值,php,laravel,laravel-5,voyager,Php,Laravel,Laravel 5,Voyager,我在后台使用voyager作为管理面板,在创建面包时遇到这种类型的错误 SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value (SQL: insert into `data_types` (`name`, `display_name_singular`, `display_name_plural`, `slug`, `icon`, `model_name`, `controller`, `poli
SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value (SQL:
insert into `data_types` (`name`, `display_name_singular`, `display_name_plural`,
`slug`, `icon`, `model_name`, `controller`, `policy_name`, `generate_permissions`,
`details`, `description`, `server_side`, `updated_at`, `created_at`) values (hdept,
Hdept, Hdepts, hdept, , App\Hdept, , , 1, {"order_column":null, "order_display_column":null,
"order_direction":"asc", "default_search_key":null}, , 0, 2019-03-04 12:56:29,
2019-03-04 12:56:29))
模型(Hdept.php)
这意味着您需要在插入新记录时指定
id
的值,或者需要在表定义中提供默认值
您可以在迁移中定义自动递增id:
$table->increments('id');
$table->increments('id');