是否可以将多个列名称分组并将它们用作选择BelongsTo中的标签/标题,我不想使用ID并且没有“名称”字段,因为所讨论的表格如下所示:
所以下拉列表应该能够让用户看到如下名称:
美国|华盛顿| $ 50.00
美国|加州| 80.00美元
美国|德克萨斯州30.00美元
Documentation says,您可以覆盖资源的标题方法:
/**
* Get the value that should be displayed to represent the resource.
*
* @return string
*/
public function title()
{
return $this->name;
}
对于某些特定于表单的显示,您可以使
BelongsTo::make('SomeModel', 'somemodel', 'App\Nova\SomeModel')
->display(function($someModel){
return $someModel->id.' wow so custom, much id';
}),