laravel-admin 展示自定义字段,包括查询
protected function grid()
{
$grid = new Grid(new AttrbuteValue());
$grid->column('name', __('Name'));
$grid->column('属性')->display(function(){
$arr = Attrbute::where('id',$this->attribute_id)->first();
if ( !$arr->name )
{
return '';
}
return $arr->name;
});
$grid->column('status', __('Status'));
$grid->column('sort', __('Sort'));
$grid->column('created_at', __('Created at'));
$grid->column('updated_at', __('Updated at'));
return $grid;
}
使用orm查询display返回展示字段