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

86 lines
2.2 KiB

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