DocterOrgController.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace App\Community\Controllers;
  3. use App\Models\Docter;
  4. use App\Models\DocterOrganization;
  5. use Encore\Admin\Controllers\AdminController;
  6. use Encore\Admin\Form;
  7. use Encore\Admin\Grid;
  8. use Encore\Admin\Show;
  9. class DocterOrgController 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 DocterOrganization());
  25. $grid->disableCreateButton(false);
  26. $grid->column('id', __('Id'));
  27. $grid->column('docter.name', __('成员名称'));
  28. $grid->column('docter.sex', __('性别'))->display(function ($w){
  29. return $w==1?'男':'女';
  30. });;
  31. $grid->column('docter.phone', __('联系方式'));
  32. $grid->column('docter.email', __('邮箱'));
  33. $grid->column('docter.name', __('身份证号'));
  34. $grid->column('docter.name', __('成员身份'));
  35. $grid->column('docter.office_id', __('所属部门'));
  36. $grid->column('docter.qualification_id', __('认证资质'));
  37. $grid->column('updated_at', __('权限设置'));
  38. return $grid;
  39. }
  40. /**
  41. * Make a show builder.
  42. *
  43. * @param mixed $id
  44. * @return Show
  45. */
  46. protected function detail($id)
  47. {
  48. $show = new Show(DocterOrganization::findOrFail($id));
  49. $show->field('id', __('Id'));
  50. $show->field('docter_id', __('Docter id'));
  51. $show->field('organization_id', __('Organization id'));
  52. $show->field('created_at', __('Created at'));
  53. $show->field('updated_at', __('Updated at'));
  54. return $show;
  55. }
  56. /**
  57. * Make a form builder.
  58. *
  59. * @return Form
  60. */
  61. protected function form()
  62. {
  63. $form = new Form(new DocterOrganization());
  64. $form->select('docter_id', __('姓名'))->options(function (){
  65. return Docter::pluck('name','id');
  66. });
  67. return $form;
  68. }
  69. }