8000 fix 判断关系复数对象 · laraveladmin-cn/laraveladmin@1d530d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1d530d1

Browse files
author
张世平
committed
fix 判断关系复数对象
1 parent 7efb756 commit 1d530d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/Http/Controllers/Traits/ResourceController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function edit($id = 0)
202202
$data['initObjRelations'] = [];
203203
//关系数据处理
204204
collect($this->editFields)->map(function ($item, $key) use ($id, &$data) {
205-
if (is_array($item) && Str::endsWith($key, 's')) { //多个关联
205+
if (is_array($item) && (Str::endsWith($key, 's') || Str::singular($key)!=$key)) { //多个关联
206206
if ($id) {
207207
$data['row'][Str::singular($key) . '_ids'] = collect(Arr::get($data, 'row.' . $key, []))->pluck( $this->newBindModel()->$key()->getRelated()->getKeyName())->toArray();
208208
$initObj = $this->editDefaultFields($this->editFields[$key],$this->newBindModel()->$key()->getRelated());

0 commit comments

Comments
 (0)
0