MedicationEntrustmentController.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Models\MedicationEntrustment;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Grid;
  6. use Dcat\Admin\Show;
  7. use Dcat\Admin\Http\Controllers\AdminController;
  8. class MedicationEntrustmentController extends AdminController
  9. {
  10. /**
  11. * Make a grid builder.
  12. *
  13. * @return Grid
  14. */
  15. protected function grid()
  16. {
  17. return Grid::make(new MedicationEntrustment(), function (Grid $grid) {
  18. $grid->column('student_id');
  19. $grid->column('reason');
  20. $grid->column('use_time');
  21. $grid->column('detail');
  22. $grid->column('desc');
  23. $grid->column('photos')->image('',80);
  24. $grid->column('sign');
  25. $grid->filter(function (Grid\Filter $filter) {
  26. $filter->equal('id');
  27. });
  28. });
  29. }
  30. /**
  31. * Make a show builder.
  32. *
  33. * @param mixed $id
  34. *
  35. * @return Show
  36. */
  37. protected function detail($id)
  38. {
  39. return Show::make($id, new MedicationEntrustment(), function (Show $show) {
  40. $show->field('id');
  41. $show->field('student_id');
  42. $show->field('reason');
  43. $show->field('use_time');
  44. $show->field('detail');
  45. $show->field('desc');
  46. $show->field('photos');
  47. $show->field('sign');
  48. $show->field('created_at');
  49. $show->field('updated_at');
  50. });
  51. }
  52. /**
  53. * Make a form builder.
  54. *
  55. * @return Form
  56. */
  57. protected function form()
  58. {
  59. return Form::make(new MedicationEntrustment(), function (Form $form) {
  60. $form->text('student_id');
  61. $form->text('reason');
  62. $form->text('use_time');
  63. $form->text('detail');
  64. $form->text('desc');
  65. $form->text('photos');
  66. $form->text('sign');
  67. });
  68. }
  69. }