DoctorManagementController.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Models\Docter;
  4. use App\Models\DocterOrganization;
  5. use App\Models\Organization;
  6. use App\Models\User;
  7. use Encore\Admin\Controllers\AdminController;
  8. use Encore\Admin\Form;
  9. use Encore\Admin\Grid;
  10. use Encore\Admin\Show;
  11. class DoctorManagementController extends AdminController
  12. {
  13. /**
  14. * Title for current resource.
  15. *
  16. * @var string
  17. */
  18. protected $title = '医生列表';
  19. /**
  20. * Make a grid builder.
  21. *
  22. * @return Grid
  23. */
  24. protected function grid()
  25. {
  26. $grid = new Grid(new Docter());
  27. $grid->column('id', __('Id'))->sortable();
  28. $grid->column('name', __('姓名'));
  29. $grid->column('avatar', __('头像'))->image('',50,50);
  30. $grid->column('score', __('评分'));
  31. $grid->column('service_persons', __('服务人数'));
  32. $grid->column('DocterOrganization', __('所属机构'));
  33. // $grid->column('DocterOrganization', __('所属机构'))->pluck('organization_id')->display(function ($organization_id){
  34. // $str = '';
  35. // foreach ($organization_id as $value)
  36. // {
  37. // $name = Organization::where('id',$value)->value('name');
  38. // $str = $str.','.$name;
  39. // }
  40. // $str = ltrim($str, ",");
  41. // return $str;
  42. // });
  43. $grid->column('teamdocter.team_id', __('团队id'));
  44. $grid->column('label', __('标签'))->map('ucwords')->implode('-');
  45. return $grid;
  46. }
  47. /**
  48. * Make a show builder.
  49. *
  50. * @param mixed $id
  51. * @return Show
  52. */
  53. protected function detail($id)
  54. {
  55. $show = new Show(Docter::findOrFail($id));
  56. $show->field('id', __('Id'));
  57. $show->field('type', __('Type'));
  58. $show->field('name', __('Name'));
  59. $show->field('phone', __('Phone'));
  60. $show->field('sex', __('Sex'));
  61. $show->field('birthday', __('Birthday'));
  62. $show->field('avatar', __('Avatar'));
  63. $show->field('status', __('Status'));
  64. $show->field('label', __('Label'));
  65. $show->field('sign', __('Sign'));
  66. $show->field('intro', __('Intro'));
  67. $show->field('office_id', __('Office id'));
  68. $show->field('qualification_id', __('Qualification id'));
  69. $show->field('score', __('Score'));
  70. $show->field('service_persons', __('Service persons'));
  71. $show->field('eva_num', __('Eva num'));
  72. $show->field('service_days', __('Service days'));
  73. $show->field('phone_minutes', __('Phone minutes'));
  74. $show->field('chat_price', __('Chat price'));
  75. $show->field('phone_price', __('Phone price'));
  76. $show->field('appoint_price', __('Appoint price'));
  77. $show->field('is_chat', __('Is chat'));
  78. $show->field('is_phone', __('Is phone'));
  79. $show->field('is_appoint', __('Is appoint'));
  80. $show->field('latitude', __('Latitude'));
  81. $show->field('longitude', __('Longitude'));
  82. $show->field('created_at', __('Created at'));
  83. $show->field('updated_at', __('Updated at'));
  84. $show->field('user_id', __('User id'));
  85. $show->field('password', __('Password'));
  86. $show->field('is_then', __('Is then'));
  87. $show->field('practice', __('Practice'));
  88. $show->field('card_photo', __('Card photo'));
  89. $show->field('is_quail', __('Is quail'));
  90. $show->field('card_id', __('Card id'));
  91. $show->field('receiving_time', __('Receiving time'));
  92. return $show;
  93. }
  94. /**
  95. * Make a form builder.
  96. *
  97. * @return Form
  98. */
  99. protected function form()
  100. {
  101. $form = new Form(new Docter());
  102. $form->switch('type', __('Type'));
  103. $form->text('name', __('Name'));
  104. $form->mobile('phone', __('Phone'));
  105. $form->switch('sex', __('Sex'));
  106. $form->text('birthday', __('Birthday'));
  107. $form->image('avatar', __('Avatar'));
  108. $form->switch('status', __('Status'))->default(1);
  109. $form->text('label', __('Label'));
  110. $form->text('sign', __('Sign'));
  111. $form->text('intro', __('Intro'));
  112. $form->number('office_id', __('Office id'));
  113. $form->number('qualification_id', __('Qualification id'));
  114. $form->decimal('score', __('Score'))->default(0.0);
  115. $form->number('service_persons', __('Service persons'));
  116. $form->number('eva_num', __('Eva num'));
  117. $form->number('service_days', __('Service days'));
  118. $form->number('phone_minutes', __('Phone minutes'));
  119. $form->number('chat_price', __('Chat price'));
  120. $form->number('phone_price', __('Phone price'));
  121. $form->number('appoint_price', __('Appoint price'));
  122. $form->switch('is_chat', __('Is chat'))->default(1);
  123. $form->switch('is_phone', __('Is phone'))->default(1);
  124. $form->switch('is_appoint', __('Is appoint'))->default(1);
  125. $form->decimal('latitude', __('Latitude'))->default(0.0000000);
  126. $form->decimal('longitude', __('Longitude'))->default(0.0000000);
  127. $form->number('user_id', __('User id'));
  128. $form->password('password', __('Password'));
  129. $form->number('is_then', __('Is then'));
  130. $form->text('practice', __('Practice'));
  131. $form->text('card_photo', __('Card photo'));
  132. $form->text('is_quail', __('Is quail'));
  133. $form->text('card_id', __('Card id'));
  134. $form->number('receiving_time', __('Receiving time'));
  135. return $form;
  136. }
  137. }