WxPostsSoundController.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace App\Admin\Controllers\Posts;
  3. use App\Admin\Repositories\Posts\WxPostsSound;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Grid;
  6. use Dcat\Admin\Show;
  7. use Dcat\Admin\Http\Controllers\AdminController;
  8. class WxPostsSoundController extends AdminController
  9. {
  10. /**
  11. * Make a grid builder.
  12. *
  13. * @return Grid
  14. */
  15. protected function grid()
  16. {
  17. return Grid::make(new WxPostsSound(), function (Grid $grid) {
  18. $grid->column('id')->sortable();
  19. $grid->column('name');
  20. $grid->column('time');
  21. $grid->column('url');
  22. $grid->column('post_id');
  23. $grid->column('created_at');
  24. $grid->column('updated_at')->sortable();
  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 WxPostsSound(), function (Show $show) {
  40. $show->field('id');
  41. $show->field('name');
  42. $show->field('time');
  43. $show->field('url');
  44. $show->field('post_id');
  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 WxPostsSound(), function (Form $form) {
  57. $form->display('id');
  58. $form->text('name');
  59. $form->text('time');
  60. $form->text('url');
  61. $form->text('post_id');
  62. $form->display('created_at');
  63. $form->display('updated_at');
  64. $form->deleting(function (Form $form){
  65. global $__MINI_GLOBAL_TENANT_ID__;
  66. if($__MINI_GLOBAL_TENANT_ID__ > 0){
  67. return $form->response()->error('权限不足,不可以删除其他分站对象');
  68. }
  69. });
  70. });
  71. }
  72. }