I have a recursive relationship, where model Question
has one to many relationship to table itself. Column parent_question_id
will refer to id
in questions
table.
In Question model
:
/**
* Get the parent that owns the question.
*/
public function parent()
{
return $this->belongsTo('App\Question', 'parent_question_id');
}
In Question resource
:
public function fields(Request $request)
{
return [
BelongsTo::make('Parent', 'parent', '\App\Nova\Question'),
...
];
}
Above code displays Question
, instead of Parent
on update. It is ok on index & detail pages.
Is there any function I can use to update the display name value for field ?
Laravel Nova version - 1.0.16