|
|
@@ -43,6 +43,9 @@ class MexOrderController extends AdminController
|
|
|
$grid->column('id', 'ID')->sortable();
|
|
|
$helper->columnUserId();
|
|
|
$helper->columnItemId();
|
|
|
+ $grid->column('item.name', '商品名称')->display(function ($value) {
|
|
|
+ return $value ?: '未知商品';
|
|
|
+ });
|
|
|
$grid->column('order_type', '订单类型')->display(function ($value) {
|
|
|
return $value instanceof OrderType ? $value->getDescription() : OrderType::from($value)->getDescription();
|
|
|
})->label([
|
|
|
@@ -96,10 +99,13 @@ class MexOrderController extends AdminController
|
|
|
*/
|
|
|
protected function detail($id)
|
|
|
{
|
|
|
- return Show::make($id, new MexOrderRepository(), function (Show $show) {
|
|
|
+ return Show::make($id, new MexOrderRepository(['item']), function (Show $show) {
|
|
|
$show->field('id', 'ID');
|
|
|
$show->field('user_id', '用户ID');
|
|
|
$show->field('item_id', '商品ID');
|
|
|
+ $show->field('item.name', '商品名称')->as(function ($value) {
|
|
|
+ return $value ?: '未知商品';
|
|
|
+ });
|
|
|
$show->field('order_type', '订单类型')->as(function ($value) {
|
|
|
return $value instanceof OrderType ? $value->getDescription() : OrderType::from($value)->getDescription();
|
|
|
});
|
|
|
@@ -130,12 +136,15 @@ class MexOrderController extends AdminController
|
|
|
*/
|
|
|
protected function form()
|
|
|
{
|
|
|
- return Form::make(new MexOrderRepository(), function (Form $form) {
|
|
|
+ return Form::make(new MexOrderRepository(['item']), function (Form $form) {
|
|
|
$helper = new FormHelper($form, $this);
|
|
|
|
|
|
$helper->display('id', 'ID');
|
|
|
$helper->display('user_id', '用户ID');
|
|
|
$helper->display('item_id', '商品ID');
|
|
|
+ $form->display('item.name', '商品名称')->with(function ($value) {
|
|
|
+ return $value ?: '未知商品';
|
|
|
+ });
|
|
|
$form->display('order_type', '订单类型')->with(function ($value) {
|
|
|
return OrderType::from($value)->getDescription();
|
|
|
});
|