我有一个递归关系,其中model Question
与表本身有一对多的关系 . parent_question_id
列将引用 questions
表中的 id
.
在 Question model
:
/**
* Get the parent that owns the question.
*/
public function parent()
{
return $this->belongsTo('App\Question', 'parent_question_id');
}
在 Question resource
:
public function fields(Request $request)
{
return [
BelongsTo::make('Parent', 'parent', '\App\Nova\Question'),
...
];
}
上面的代码显示 Question
,而不是更新时的 Parent
. 它在索引和详细信息页面上都可以 .
是否有任何功能可用于更新字段的显示名称值?
Laravel Nova版本 - 1.0.16
1 回答
我试过设置
label
并没有用 . 但设置singularLabel
对我有用 .Update
问题不再出现在v1.1.7中