如何解决如何在Backpack laravel中保存select2_from_ajax_multiple中的多个值
大家
我想从 select 选项中保存多个值,但我不知道如何在 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,]);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。