海南旅游SAAS
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.

83 lines
2.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Repositories\User;
  4. use App\Common\UserStatus;
  5. use Dcat\Admin\Form;
  6. use Dcat\Admin\Grid;
  7. use Dcat\Admin\Show;
  8. use Dcat\Admin\Http\Controllers\AdminController;
  9. class UserController extends AdminController
  10. {
  11. /**
  12. * Make a grid builder.
  13. *
  14. * @return Grid
  15. */
  16. protected function grid()
  17. {
  18. return Grid::make(new User('agent:id,name'), function (Grid $grid) {
  19. $grid->disableRowSelector();
  20. $grid->disableCreateButton();
  21. $grid->disableActions();
  22. $grid->column('id')->sortable();
  23. $grid->column('agent.name', '所属代理商');
  24. $grid->column('avatar')->image('', 60, 60);
  25. $grid->column('mobile');
  26. $grid->column('nickname');
  27. $grid->column('status')->bool();
  28. $grid->column('created_at');
  29. $grid->column('updated_at');
  30. $grid->filter(function (Grid\Filter $filter) {
  31. $filter->panel();
  32. $filter->equal('id')->width(1);
  33. $filter->equal('mobile')->width(2);
  34. });
  35. });
  36. }
  37. /**
  38. * Make a show builder.
  39. *
  40. * @param mixed $id
  41. *
  42. * @return Show
  43. */
  44. protected function detail($id)
  45. {
  46. return Show::make($id, new User(['agent:id,name']), function (Show $show) {
  47. $show->disableDeleteButton();
  48. $show->field('id');
  49. $show->field('agent.name', '代理商');
  50. $show->field('avatar')->image('', 80, 80);
  51. $show->field('mobile');
  52. $show->field('nickname');
  53. $show->field('status')->bool();
  54. $show->field('created_at');
  55. $show->field('updated_at');
  56. });
  57. }
  58. /**
  59. * Make a form builder.
  60. *
  61. * @return Form
  62. */
  63. protected function form()
  64. {
  65. return Form::make(new User(), function (Form $form) {
  66. $form->disableDeleteButton();
  67. /*$form->display('id');
  68. $form->text('status');*/
  69. })->deleting(function (Form $form) {
  70. return $form->response()->error('禁止删除');
  71. });
  72. }
  73. }