链街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.

68 lines
1.6 KiB

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 function grid()
  16. {
  17. return Grid::make(new LanzuServiceSpeaker(['store']), function (Grid $grid) {
  18. $grid->id->sortable();
  19. $grid->device_name;
  20. $grid->store_id;
  21. $grid->column('store.name');
  22. $grid->column('is_bind')
  23. ->using([0=>'未绑定',1=>'已绑定'])
  24. ->label([0=>'danger',1=>'success']);
  25. $grid->created_at;
  26. $grid->updated_at->sortable();
  27. $grid->filter(function (Grid\Filter $filter) {
  28. $filter->equal('id');
  29. $filter->equal('store_id');
  30. });
  31. });
  32. }
  33. /**
  34. * Make a show builder.
  35. *
  36. * @param mixed $id
  37. *
  38. * @return Show
  39. */
  40. protected function detail($id)
  41. {
  42. return Show::make($id, new LanzuServiceSpeaker(), function (Show $show) {
  43. $show->id;
  44. $show->created_at;
  45. $show->updated_at;
  46. });
  47. }
  48. /**
  49. * Make a form builder.
  50. *
  51. * @return Form
  52. */
  53. protected function form()
  54. {
  55. return Form::make(new LanzuServiceSpeaker(), function (Form $form) {
  56. $form->display('id');
  57. //$form->image("device_name")->disk('oss');
  58. $form->display('created_at');
  59. $form->display('updated_at');
  60. });
  61. }
  62. }