如何修改 Laravel-Backpack/Settings 中的字段

How to modify field in Laravel-Backpack/Settings

我想在 Laravel-Backpack/Settings、admin/setting/10/edit 页面的值字段中添加一个下拉菜单,而不是文本字段。我很感激任何建议。

我在数据库设置字段中使用了以下内容,但出现错误。

{"name":"value","label":"Value", "title":"Lightbox" ,"type":"select_from_array",
"options":{"lightbox":"lightbox","colorbox1":"colorbox1"}

错误

ErrorException in Fields.php line 28: Undefined index: name in Fields.php line 28 at HandleExceptions->handleError('8', 'Undefined index: name', '/Users/sokada/Code/backpack-ceci/vendor/backpack/crud/src/PanelTraits/Fields.php', '28', array('field' => array(), 'form' => 'both', 'complete_field_array' => array())) in Fields.php line 28 at CrudPanel->addField(array()) in SettingCrudController.php line 69

Fields.php 中的第 28 行如下。

...
    // if the label is missing, we should set it
    if (! isset($complete_field_array['label'])) {
        $complete_field_array['label'] = ucfirst($complete_field_array['name']);
    }
...

你的代码对我有用。

你确定你没有漏掉结尾的括号吗?

{"name":"value","label":"Value", "title":"Lightbox" ,"type":"select_from_array", "options":{"lightbox":"lightbox","colorbox1":"colorbox1"}}