链街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.4 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. * @return Grid
  19. */
  20. protected function grid()
  21. {
  22. $user = Admin::user();
  23. $mp_info = mpInfo::where('admin_user_id',$user->id)->first();
  24. $mk = ImsCjdcMarket::where('mp_id',$mp_info->id)->get()->pluck('id');
  25. $mk_ids = [-1];
  26. if(count($mk)>0){
  27. $mk_ids = $mk;
  28. }
  29. $ids = LanzuMmInfo::whereIn('market_id',$mk_ids)->pluck('id');
  30. $buider = MmWithdraw::with('mmInfo')->whereIn('mm_id',$ids);
  31. return Grid::make($buider, function (Grid $grid) {
  32. //$grid->model()->mmInfo()->where('market_id',1);
  33. $grid->id->sortable();
  34. //$grid->mm_id('提现');
  35. $grid->column('mmInfo.name','经理名');
  36. $grid->money;
  37. $grid->status('提现状态')->using([-1=>'拒绝',0=>'审核中',1=>'通过'])
  38. ->label([-1=>'danger',0=>'default',1=>'success']);
  39. $grid->created_at('提现时间')->display(function ($time){
  40. return date('Y-m-d H:i',$time);
  41. });
  42. $grid->filter(function (Grid\Filter $filter) {
  43. $filter->equal('id');
  44. });
  45. });
  46. }
  47. /**
  48. * Make a show builder.
  49. *
  50. * @param mixed $id
  51. *
  52. * @return Show
  53. */
  54. protected function detail($id)
  55. {
  56. return Show::make($id, new LanzuMmWithdraw(), function (Show $show) {
  57. $show->id;
  58. $show->mm_id;
  59. $show->money;
  60. $show->status;
  61. $show->created_at;
  62. $show->updated_at;
  63. });
  64. }
  65. /**
  66. * Make a form builder.
  67. *
  68. * @return Form
  69. */
  70. protected function form()
  71. {
  72. return Form::make(new LanzuMmWithdraw(), function (Form $form) {
  73. $form->display('id');
  74. $form->text('mm_id');
  75. $form->text('money');
  76. $form->display('created_at');
  77. $form->display('updated_at');
  78. });
  79. }
  80. }