DocterController.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. namespace App\Community\Controllers;
  3. use App\Models\Docter;
  4. use Encore\Admin\Controllers\AdminController;
  5. use Encore\Admin\Facades\Admin;
  6. use Encore\Admin\Form;
  7. use Encore\Admin\Grid;
  8. use Encore\Admin\Show;
  9. class DocterController extends AdminController
  10. {
  11. /**
  12. * Title for current resource.
  13. *
  14. * @var string
  15. */
  16. protected $title = '用户管理';
  17. /**
  18. * Make a grid builder.
  19. *
  20. * @return Grid
  21. */
  22. protected function grid()
  23. {
  24. $grid = new Grid(new Docter());
  25. // $grid->model()->whereHas('orgdocter')->where(['organziation_id'=>Admin::user()->org_id]);
  26. $grid->column('id', __('Id'));
  27. $grid->column('type', __('Type'));
  28. $grid->column('name', __('Name'));
  29. $grid->column('phone', __('Phone'));
  30. $grid->column('sex', __('Sex'));
  31. $grid->column('office_id', __('office id'));
  32. $grid->column('qualification_id', __('Qualification id'));
  33. $grid->column('service_persons', __('Service persons'));
  34. return $grid;
  35. }
  36. /**
  37. * Make a show builder.
  38. *
  39. * @param mixed $id
  40. * @return Show
  41. */
  42. protected function detail($id)
  43. {
  44. $show = new Show(Docter::findOrFail($id));
  45. $show->field('id', __('Id'));
  46. $show->field('type', __('Type'));
  47. $show->field('name', __('Name'));
  48. $show->field('phone', __('Phone'));
  49. $show->field('sex', __('Sex'));
  50. $show->field('birthday', __('Birthday'));
  51. $show->field('avatar', __('Avatar'));
  52. $show->field('status', __('Status'));
  53. $show->field('label', __('Label'));
  54. $show->field('sign', __('Sign'));
  55. $show->field('intro', __('Intro'));
  56. $show->field('office_id', __('Office id'));
  57. $show->field('qualification_id', __('Qualification id'));
  58. $show->field('score', __('Score'));
  59. $show->field('service_persons', __('Service persons'));
  60. $show->field('eva_num', __('Eva num'));
  61. $show->field('service_days', __('Service days'));
  62. $show->field('phone_minutes', __('Phone minutes'));
  63. $show->field('chat_price', __('Chat price'));
  64. $show->field('phone_price', __('Phone price'));
  65. $show->field('appoint_price', __('Appoint price'));
  66. $show->field('is_chat', __('Is chat'));
  67. $show->field('is_phone', __('Is phone'));
  68. $show->field('is_appoint', __('Is appoint'));
  69. $show->field('latitude', __('Latitude'));
  70. $show->field('longitude', __('Longitude'));
  71. $show->field('created_at', __('Created at'));
  72. $show->field('updated_at', __('Updated at'));
  73. return $show;
  74. }
  75. /**
  76. * Make a form builder.
  77. *
  78. * @return Form
  79. */
  80. protected function form()
  81. {
  82. $form = new Form(new Docter());
  83. $form->switch('type', __('Type'));
  84. $form->text('name', __('Name'));
  85. $form->mobile('phone', __('Phone'));
  86. $form->switch('sex', __('Sex'));
  87. $form->text('birthday', __('Birthday'));
  88. $form->image('avatar', __('Avatar'));
  89. $form->switch('status', __('Status'))->default(1);
  90. $form->text('label', __('Label'));
  91. $form->text('sign', __('Sign'));
  92. $form->text('intro', __('Intro'));
  93. $form->number('office_id', __('Office id'));
  94. $form->number('qualification_id', __('Qualification id'));
  95. $form->decimal('score', __('Score'))->default(0.0);
  96. $form->number('service_persons', __('Service persons'));
  97. $form->number('eva_num', __('Eva num'));
  98. $form->number('service_days', __('Service days'));
  99. $form->number('phone_minutes', __('Phone minutes'));
  100. $form->number('chat_price', __('Chat price'));
  101. $form->number('phone_price', __('Phone price'));
  102. $form->number('appoint_price', __('Appoint price'));
  103. $form->switch('is_chat', __('Is chat'))->default(1);
  104. $form->switch('is_phone', __('Is phone'))->default(1);
  105. $form->switch('is_appoint', __('Is appoint'))->default(1);
  106. $form->decimal('latitude', __('Latitude'))->default(0.0000000);
  107. $form->decimal('longitude', __('Longitude'))->default(0.0000000);
  108. return $form;
  109. }
  110. }