Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel Voyager SQLSTATE[HY000]:一般错误:1364字段';id';不';没有默认值_Php_Laravel_Laravel 5_Voyager - Fatal编程技术网

Php Laravel Voyager SQLSTATE[HY000]:一般错误:1364字段';id';不';没有默认值

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

我在后台使用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`, `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');