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

111 lines
2.8 KiB

6 years ago
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Repositories\LanzuMpInfo;
  4. use Dcat\Admin\Admin;
  5. use Dcat\Admin\Form;
  6. use Dcat\Admin\Grid;
  7. use Dcat\Admin\Show;
  8. use Dcat\Admin\Controllers\AdminController;
  9. class LanzuMpInfoController extends AdminController
  10. {
  11. /**
  12. * Make a grid builder.
  13. *
  14. * @return Grid
  15. */
  16. protected function grid()
  17. {
  18. return Grid::make(new LanzuMpInfo(), function (Grid $grid) {
  19. $grid->id->sortable();
  20. $grid->name;
  21. $grid->phone;
  22. $grid->bank_name;
  23. $grid->bank_card;
  24. $grid->bank_addr;
  25. $grid->id_frond;
  26. $grid->id_back;
  27. $grid->id_number;
  28. $grid->admin_user_id;
  29. $grid->column('status','状态');
  30. $grid->created_at->display(function ($time) {
  31. return date("Y-m-d H:i:s",$time);
  32. });
  33. $grid->filter(function (Grid\Filter $filter) {
  34. $filter->equal('id');
  35. });
  36. $grid->filter(function (Grid\Filter $filter) {
  37. $filter->like('name');
  38. });
  39. $grid->actions(function (Grid\Displayers\Actions $actions) {
  40. // append一个操作
  41. $actions->append('<a href=""><i class="fa fa-eye"></i>发货</a>');
  42. // prepend一个操作
  43. $actions->prepend('<a href=""><i class="fa fa-paper-plane"></i></a>');
  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 LanzuMpInfo(), function (Show $show) {
  57. $show->id;
  58. $show->name;
  59. $show->phone;
  60. $show->bank_name;
  61. $show->bank_card;
  62. $show->bank_addr;
  63. $show->id_frond;
  64. $show->id_back;
  65. $show->id_number;
  66. $show->admin_user_id;
  67. $show->status;
  68. $show->created_at;
  69. $show->updated_at;
  70. });
  71. }
  72. /**
  73. * Make a form builder.
  74. *
  75. * @return Form
  76. */
  77. protected function form()
  78. {
  79. return Form::make(new LanzuMpInfo(), function (Form $form) {
  80. $form->creating(function (Form $form){
  81. echo 11222;die;
  82. });
  83. $form->display('id')->hideInDialog();
  84. $form->text('name');
  85. $form->text('phone');
  86. $form->text('bank_name');
  87. $form->text('bank_card');
  88. $form->text('bank_addr');
  89. $form->image('id_frond');
  90. $form->image('id_back');
  91. $form->text('id_number');
  92. $form->text('admin_user_id');
  93. $form->number('status');
  94. $form->display('created_at');
  95. $form->display('updated_at');
  96. });
  97. }
  98. }