链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.0 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Repositories\LanzuServiceSpeaker;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Grid;
  6. use Dcat\Admin\Show;
  7. use Dcat\Admin\Controllers\AdminController;
  8. class LanzuServiceSpeakerController extends AdminController
  9. {
  10. /**
  11. * Make a grid builder.
  12. *
  13. * @return Grid
  14. */
  15. protected $title = '播报机管理';
  16. protected function grid()
  17. {
  18. return Grid::make(new LanzuServiceSpeaker(['store']), function (Grid $grid) {
  19. $grid->model()->orderBy('updated_at','desc');
  20. $grid->id->sortable();
  21. $grid->column('device_name','设备编号');
  22. $grid->column('store_id','商户ID');
  23. $grid->column('store.name','商户名');
  24. $grid->column('is_bind')
  25. ->using([0=>'未绑定',1=>'已绑定'])
  26. ->label([0=>'danger',1=>'success']);
  27. $grid->created_at;
  28. $grid->updated_at->sortable();
  29. $grid->filter(function (Grid\Filter $filter) {
  30. $filter->equal('id');
  31. $filter->equal('store_id');
  32. });
  33. });
  34. }
  35. /**
  36. * Make a show builder.
  37. *
  38. * @param mixed $id
  39. *
  40. * @return Show
  41. */
  42. protected function detail($id)
  43. {
  44. return Show::make($id, new LanzuServiceSpeaker(), function (Show $show) {
  45. $show->id;
  46. $show->created_at;
  47. $show->updated_at;
  48. });
  49. }
  50. /**
  51. * Make a form builder.
  52. *
  53. * @return Form
  54. */
  55. protected function form()
  56. {
  57. return Form::make(new LanzuServiceSpeaker(), function (Form $form) {
  58. $form->display('id');
  59. $form->text("device_name",'设备编号')->required();
  60. $form->number("store_id",'商户ID')->required();
  61. $form->switch('is_bind', '是否绑定');
  62. //$form->image("device_name")->disk('oss');
  63. $form->display('created_at');
  64. $form->display('updated_at');
  65. });
  66. }
  67. }