ActivityRangeController.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Models\ActivityRange;
  4. use Encore\Admin\Controllers\AdminController;
  5. use Encore\Admin\Form;
  6. use Encore\Admin\Grid;
  7. use Encore\Admin\Show;
  8. class ActivityRangeController extends AdminController
  9. {
  10. /**
  11. * Title for current resource.
  12. *
  13. * @var string
  14. */
  15. protected $title = 'ActivityRange';
  16. /**
  17. * Make a grid builder.
  18. *
  19. * @return Grid
  20. */
  21. protected function grid()
  22. {
  23. $grid = new Grid(new ActivityRange());
  24. $grid->column('id', __('Id'));
  25. $grid->column('name', __('区域名称'));
  26. // $grid->column('created_at', __('创建时间'));
  27. // $grid->column('updated_at', __('修改时间'));
  28. return $grid;
  29. }
  30. /**
  31. * Make a show builder.
  32. *
  33. * @param mixed $id
  34. * @return Show
  35. */
  36. protected function detail($id)
  37. {
  38. $show = new Show(ActivityRange::findOrFail($id));
  39. $show->field('id', __('Id'));
  40. $show->field('name', __('区域名称'));
  41. $show->field('created_at', __('创建时间'));
  42. $show->field('updated_at', __('修改时间'));
  43. return $show;
  44. }
  45. /**
  46. * Make a form builder.
  47. *
  48. * @return Form
  49. */
  50. protected function form()
  51. {
  52. $form = new Form(new ActivityRange());
  53. $form->text('name', __('区域名称'));
  54. return $form;
  55. }
  56. }