LeaveMessageController.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Models\LeaveMessage;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Grid;
  6. use Dcat\Admin\Show;
  7. use Dcat\Admin\Http\Controllers\AdminController;
  8. class LeaveMessageController extends AdminController
  9. {
  10. /**
  11. * Make a grid builder.
  12. *
  13. * @return Grid
  14. */
  15. protected function grid()
  16. {
  17. return Grid::make(new LeaveMessage(), function (Grid $grid) {
  18. $grid->column('parent_id')->using(config('map.parent_ids'));
  19. $grid->column('student_id')->using(config('map.students'));
  20. $grid->column('content')->limit(50);
  21. $grid->column('created_at');
  22. $grid->column('deal_status')->using(config('map.deal_status'));
  23. $grid->filter(function (Grid\Filter $filter) {
  24. $filter->panel();
  25. $filter->between('created_at')->datetime()->width(4);
  26. $filter->equal('student_id','输入/选择学生')->select(config('map.students'))->width(4);
  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 LeaveMessage(), function (Show $show) {
  40. $show->field('id');
  41. $show->field('parent_id');
  42. $show->field('student_id');
  43. $show->field('content');
  44. $show->field('deal_status');
  45. $show->field('created_at');
  46. $show->field('updated_at');
  47. });
  48. }
  49. /**
  50. * Make a form builder.
  51. *
  52. * @return Form
  53. */
  54. protected function form()
  55. {
  56. return Form::make(new LeaveMessage(), function (Form $form) {
  57. $form->text('parent_id');
  58. $form->text('student_id');
  59. $form->text('content');
  60. $form->text('deal_status');
  61. });
  62. }
  63. }