链街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.

116 lines
2.9 KiB

  1. <?php
  2. namespace App\Admin\Controllers;
  3. use Dcat\Admin\Form;
  4. use Dcat\Admin\Grid;
  5. use Dcat\Admin\Show;
  6. use Dcat\Admin\Layout\Content;
  7. use Dcat\Admin\Controllers\AdminController;
  8. use Dcat\Admin\Widgets\Card;
  9. use App\Admin\Repositories\CouponTie;
  10. use App\Admin\Forms\CouponTieForm;
  11. use App\Admin\Extensions\CouponTieEdit;
  12. class CouponTieController extends AdminController
  13. {
  14. /**
  15. * Make a grid builder.
  16. *
  17. * @return Grid
  18. */
  19. protected function grid()
  20. {
  21. return Grid::make(new CouponTie(), function (Grid $grid) {
  22. $grid->activity->sortable();
  23. $grid->forward->sortable();
  24. $grid->repay->sortable();
  25. });
  26. }
  27. public function CouponTieList(Content $content){
  28. $grid = Grid::make(new CouponTie(), function (Grid $grid) {
  29. $grid->id;
  30. $grid->activity->sortable();
  31. $grid->forward->sortable();
  32. $grid->repay->sortable();
  33. $grid->disableViewButton();
  34. $grid->disableEditButton();
  35. $grid->disableDeleteButton();
  36. $grid->actions(new CouponTieEdit());
  37. });
  38. return $content
  39. ->title('活动绑定')
  40. ->body(new Card($grid));
  41. }
  42. public function CouponTieForm(Content $content){
  43. return $content
  44. ->title('活动绑定')
  45. ->body(new Card(new CouponTieForm()), function(Form $form){
  46. $form->submitted(function (Form $form) {
  47. // 获取用户提交参数
  48. $activity = $form->activity;
  49. // 中断后续逻辑
  50. return $this->error('服务器出错了~');
  51. });
  52. $form->saved(function (Form $form, $result) {
  53. // 判断是否是新增操作
  54. if ($form->isCreating()) {
  55. // 自增ID
  56. $newId = $result;
  57. // 也可以这样获取自增ID
  58. $newId = $form->getKey();
  59. if (! $newId) {
  60. return $form->error('数据保存失败');
  61. }
  62. return;
  63. }
  64. // 修改操作
  65. });
  66. });
  67. }
  68. /**
  69. * Make a show builder.
  70. *
  71. * @param mixed $id
  72. *
  73. * @return Show
  74. */
  75. // protected function detail($id)
  76. // {
  77. // return Show::make($id, new ImsCjdcMarket(), function (Show $show) {
  78. // });
  79. // }
  80. // /**
  81. // * Make a form builder.
  82. // *
  83. // * @return Form
  84. // */
  85. protected function form(Content $content)
  86. {
  87. return $content
  88. ->title('活动绑定')
  89. ->body(new Card(new CouponTieForm()));
  90. }
  91. // /**
  92. // * 服务商信息
  93. // * @return \Illuminate\Http\JsonResponse
  94. // */
  95. // protected function getMpInfo()
  96. // {
  97. // }
  98. }