WxSyncRelationController.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Repositories\WxSyncRelation;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Grid;
  6. use Dcat\Admin\Show;
  7. use Dcat\Admin\Http\Controllers\AdminController;
  8. class WxSyncRelationController extends AdminController
  9. {
  10. /**
  11. * Make a grid builder.
  12. *
  13. * @return Grid
  14. */
  15. protected function grid()
  16. {
  17. return Grid::make(new WxSyncRelation(), function (Grid $grid) {
  18. $grid->simplePaginate();
  19. $grid->model()->orderBy('id', 'desc');
  20. $grid->column('id')->sortable();
  21. $grid->column('domain');
  22. $grid->column('type');
  23. $grid->column('inner_id');
  24. $grid->column('external_id');
  25. $grid->column('status');
  26. $grid->column('created_at');
  27. $grid->column('updated_at')->sortable();
  28. $grid->filter(function (Grid\Filter $filter) {
  29. $filter->equal('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 WxSyncRelation(), function (Show $show) {
  43. $show->field('id');
  44. $show->field('domain');
  45. $show->field('type');
  46. $show->field('inner_id');
  47. $show->field('external_id');
  48. $show->field('status');
  49. $show->field('created_at');
  50. $show->field('updated_at');
  51. });
  52. }
  53. /**
  54. * Make a form builder.
  55. *
  56. * @return Form
  57. */
  58. protected function form()
  59. {
  60. return Form::make(new WxSyncRelation(), function (Form $form) {
  61. $form->display('id');
  62. $form->display('domain');
  63. $form->display('type');
  64. $form->text('inner_id');
  65. $form->text('external_id');
  66. $form->text('status');
  67. $form->display('created_at');
  68. $form->display('updated_at');
  69. $form->deleting(function (Form $form){
  70. global $__MINI_GLOBAL_TENANT_ID__;
  71. if($__MINI_GLOBAL_TENANT_ID__ > 0){
  72. return $form->response()->error('权限不足,不可以删除其他分站对象');
  73. }
  74. });
  75. });
  76. }
  77. }