OpenPackController.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Admin\Controllers;
  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 = 'Order';
  15. /**
  16. * Make a grid builder.
  17. *
  18. * @return Grid
  19. */
  20. protected function grid()
  21. {
  22. $grid = new Grid(new Order());
  23. $grid->model()->where('product_type','6');
  24. $grid->column('id', __('订单ID'));
  25. $grid->column('user_id', __('用户ID'));
  26. $grid->column('user.name','用户姓名');
  27. $grid->column('patients.name', __('患者名称'));
  28. $grid->column('orderPack.service_pack_id', __('服务包ID'));
  29. $grid->column('orderPack.pack_name', __('服务包名称'));
  30. $grid->column('orderPack.pack_price', __('服务包价格'));
  31. $grid->column('orderPack.team_id', __('所属团队'))->display(function ($model){
  32. $name = Team::where('id',$model)->value('name');
  33. return $name;
  34. });
  35. $grid->column('created_at', __('Created at'));
  36. $grid->column('updated_at', __('Updated at'));
  37. return $grid;
  38. }
  39. }