当我在我的机器上本地运行背包演示时,当我想编辑或添加一个文章时,会发生以下错误:
SQLSTATE[HY000]: General error: 1 near "SHOW": syntax error
(SQL: SHOW COLUMNS FROM `articles` WHERE Field = "status")此错误不会发生在在线演示https://demo.backpackforlaravel.com/admin/article/create或https://demo.backpackforlaravel.com/admin/article/1/edit上。
发布于 2021-05-05 09:47:26
如文档中所述:https://backpackforlaravel.com/docs/4.1/crud-fields#enum-1
请注意,枚举字段仅适用于MySQL数据库。
使用SQLite时,解决方案是将enum类型更改为ArticleCrudController中的select_from_array类型。
$this->crud->addField([
'name' => 'status',
'label' => 'Status',
// 'type' => 'enum', // not supported by SQLite
'type' => 'select_from_array',
'options' => [
'PUBLISHED' => 'PUBLISHED',
'DRAFT' => 'DRAFT',
],
]);https://stackoverflow.com/questions/67398912
复制相似问题