链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.3 KiB

5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Repositories\LanzuMmWithdraw;
  4. use App\Models\LanzuMmWithdraw as MmWithdraw;
  5. use App\Models\LanzuMmInfo;
  6. use App\Models\ImsCjdcMarket;
  7. use App\Models\LanzuMpInfo as mpInfo;
  8. use Dcat\Admin\Form;
  9. use Dcat\Admin\Grid;
  10. use Dcat\Admin\Show;
  11. use Dcat\Admin\Controllers\AdminController;
  12. use Dcat\Admin\Admin;
  13. use Illuminate\Support\Facades\Auth;
  14. class LanzuMmWithdrawController extends AdminController
  15. {
  16. /**
  17. * Make a grid builder.
  18. *
  19. * @return Grid
  20. */
  21. protected function grid()
  22. {
  23. $user = Admin::user();
  24. $mp_info = mpInfo::where('admin_user_id',$user->id)->first();
  25. $mk = ImsCjdcMarket::where('mp_id',$mp_info->id)->get()->pluck('id');
  26. $mk_ids = [-1];
  27. if(count($mk)>0){
  28. $mk_ids = $mk;
  29. }
  30. $ids = LanzuMmInfo::whereIn('market_id',$mk_ids)->pluck('id');
  31. $buider = MmWithdraw::with('mmInfo')->whereIn('mm_id',$ids);
  32. return Grid::make($buider, function (Grid $grid) {
  33. //$grid->model()->mmInfo()->where('market_id',1);
  34. $grid->id->sortable();
  35. //$grid->mm_id('提现');
  36. $grid->column('mmInfo.name','经理名');
  37. $grid->money;
  38. $grid->status('提现状态')->using([-1=>'拒绝',0=>'审核中',1=>'通过'])
  39. ->label([-1=>'danger',0=>'default',1=>'success']);
  40. $grid->created_at('提现时间');
  41. $grid->filter(function (Grid\Filter $filter) {
  42. $filter->equal('id');
  43. });
  44. });
  45. }
  46. /**
  47. * Make a show builder.
  48. *
  49. * @param mixed $id
  50. *
  51. * @return Show
  52. */
  53. protected function detail($id)
  54. {
  55. return Show::make($id, new LanzuMmWithdraw(), function (Show $show) {
  56. $show->id;
  57. $show->mm_id;
  58. $show->money;
  59. $show->status;
  60. $show->created_at;
  61. $show->updated_at;
  62. });
  63. }
  64. /**
  65. * Make a form builder.
  66. *
  67. * @return Form
  68. */
  69. protected function form()
  70. {
  71. return Form::make(new LanzuMmWithdraw(), function (Form $form) {
  72. $form->display('id');
  73. $form->text('mm_id');
  74. $form->text('money');
  75. $form->display('created_at');
  76. $form->display('updated_at');
  77. });
  78. }
  79. }