OpenPackController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Admin\Controllers\ServicePacksManagment;
  3. use App\Models\Team;
  4. use App\Models\Order;
  5. use Encore\Admin\Controllers\AdminController;
  6. use Encore\Admin\Grid;
  7. class OpenPackController extends AdminController
  8. {
  9. /**
  10. * Title for current resource.
  11. *
  12. * @var string
  13. */
  14. protected $title = '开通记录';
  15. /**
  16. * Make a grid builder.
  17. *
  18. * @return Grid
  19. */
  20. protected function grid()
  21. {
  22. $grid = new Grid(new Order());
  23. $grid->disableActions();
  24. $grid->model()->where('product_type','6')->orderBy('id','desc');
  25. $grid->column('id', __('订单ID'));
  26. $grid->column('user_id', __('用户ID'));
  27. $grid->column('user.nickname','用户姓名');
  28. $grid->column('orderPatient.name', __('患者名称'));
  29. $grid->column('orderPack.service_pack_id', __('服务包ID'));
  30. $grid->column('orderPack.pack_name', __('服务包名称'));
  31. $grid->column('orderPack.pack_price', __('服务包价格'));
  32. $grid->column('orderPack.team_id', __('所属团队'))->display(function ($model){
  33. $name = Team::where('id',$model)->value('name');
  34. return $name;
  35. });
  36. $grid->column('created_at', __('创建时间'));
  37. return $grid;
  38. }
  39. }