php - 如何从背包 laravel 中的 select2_from_ajax_multiple 中保存多个值
问题描述
每个人
我正在尝试从选择选项中保存多个值,但我不知道如何在 laravel Backpack中保存。我一直在尝试解决 2 天以来的错误,但它仍然无法从我这边工作。
但它不会保存在数据库中,但如果我要编辑记录,它会给出这个错误---
这是我的控制器代码
CRUD::addField([ // select2_from_ajax: 1-n relationship
'label' => "City Name", // Table column heading
'type' => 'select2_from_ajax_multiple',
'name' => 'location_id', // the column that contains the ID of that connected entity;
'entity' => 'location', // the method that defines the relationship in your Model
'attribute' => 'name', // foreign key attribute that is shown to user
'tab' => 'Texts',
'data_source' => url('api/location'), // url to controller search function (with /{id} should return model)
'placeholder' => 'Select location', // placeholder for the select
'include_all_form_fields' => true, //sends the other form fields along with the request so it can be filtered.
'minimum_input_length' => 0, // minimum characters to type before querying results
'dependencies' => ['state'], // when a dependency changes, this select2 is reset to null
// 'method' => 'GET', // optional - HTTP method to use for the AJAX call (GET, POST)
"allows_multiple" => true,
'pivot' => true,
]);
解决方案
推荐阅读
- nginx - 带有 CentOS 和 Nginx 的 blazor 上的 websocket 问题
- active-directory - 如何减少 AD LDAP 过滤器
- algorithm - 日志值是否以整数(无浮点值)或双精度或舍入值的形式考虑
- types - Julia 数据类型:什么时候应该使用结构体、字典、命名元组或数据框?
- ms-access - 选择文件夹和文件名以保存 32 位和 64 位 MS-Access-2016 的新文件
- r - 在`dplyr`中计算频率列表
- python - 从满足两个条件的 Dataframe 中获取索引和列
- python - TypeError: stat: path 应该是字符串、字节、OS.PathLike 或整数,而不是列表?
- amazon-cloudwatch - EventRule 默认匹配 EventBridge EventBus 被自定义 EventBus 忽略
- google-apps-script - 例外:参数 (number[]) 与 DocumentApp.Body.appendTable 的方法签名不匹配