-
Notifications
You must be signed in to change notification settings - Fork 770
在表单中使用多对多的表格,出现__remove__错误 #59
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
错误信息:
exception: "ErrorException"
file: "/Users/ray/shoes-manage/vendor/dcat/laravel-admin/src/Form/Field/Table.php"
line: 73
message: "Undefined index: _remove_"form部分代码:
$form->table('item', function (Form\NestedForm $table) {
$table->select('item_id', '所属分类')->options(function ($id) {
$item = Item::find($id);
if ($item) {
return [$item->id => $item->name];
}
})->ajax('api/item')->required();
$table->decimal('price', '价格')->required();
});OrderModel
public function item(): BelongsToMany
{
$pivotTable = 'order_item'; // 中间表
$relatedModel = Item::class; // 关联模型类名
return $this->belongsToMany($relatedModel, $pivotTable, 'order_id', 'item_id');
} public function order(): BelongsToMany
{
$pivotTable = 'order_item'; // 中间表
$relatedModel = Order::class; // 关联模型类名
return $this->belongsToMany($relatedModel, $pivotTable, 'item_id', 'order_id');
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

