以官方Demo爲例:
php
DataForm頁面java
去掉全部的複選框, 點擊 Save 按鈕this
從新打開DataForm頁面, 數據並無改變, 這是bugcode
若至少保留其中一項, 則結果會改變orm
修改文件:get
vendor/zofe/rapyd/src/DataForm/Field/Field.php
修改前:io
public function updateRelations() { ..... case 'Illuminate\Database\Eloquent\Relations\BelongsToMany': $old_data = $this->relation->get()->modelKeys(); $new_data = explode($this->serialization_sep, $data); $this->relation->detach($old_data); if ($data=='') { continue; } .....
修改後:function
public function updateRelations() { case 'Illuminate\Database\Eloquent\Relations\BelongsToMany': ..... $old_data = $this->relation->get()->modelKeys(); // $data 改爲 $this->new_value $new_data = explode($this->serialization_sep, $this->new_value); $this->relation->detach($old_data); //判斷條件修改 if (empty($this->new_value)) { break; } ......