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

80 lines
1.8 KiB

5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Repositories\CouponSetting;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Grid;
  6. use Dcat\Admin\Show;
  7. use Dcat\Admin\Controllers\AdminController;
  8. class CouponSettingController extends AdminController
  9. {
  10. /**
  11. * Make a grid builder.
  12. *
  13. * @return Grid
  14. */
  15. protected function grid()
  16. {
  17. return Grid::make(new CouponSetting(), function (Grid $grid) {
  18. $grid->id->sortable();
  19. $grid->name;
  20. $grid->category;
  21. $grid->value;
  22. $grid->desc;
  23. $grid->sort;
  24. $grid->status;
  25. $grid->created_at;
  26. $grid->updated_at->sortable();
  27. $grid->filter(function (Grid\Filter $filter) {
  28. $filter->equal('id');
  29. });
  30. });
  31. }
  32. /**
  33. * Make a show builder.
  34. *
  35. * @param mixed $id
  36. *
  37. * @return Show
  38. */
  39. protected function detail($id)
  40. {
  41. return Show::make($id, new CouponSetting(), function (Show $show) {
  42. $show->id;
  43. $show->name;
  44. $show->category;
  45. $show->value;
  46. $show->desc;
  47. $show->sort;
  48. $show->status;
  49. $show->created_at;
  50. $show->updated_at;
  51. });
  52. }
  53. /**
  54. * Make a form builder.
  55. *
  56. * @return Form
  57. */
  58. protected function form()
  59. {
  60. return Form::make(new CouponSetting(), function (Form $form) {
  61. $form->display('id');
  62. $form->text('name');
  63. $form->text('category');
  64. $form->text('value');
  65. $form->text('desc');
  66. $form->text('sort');
  67. $form->text('status');
  68. $form->display('created_at');
  69. $form->display('updated_at');
  70. });
  71. }
  72. }