海南旅游SAAS
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.

78 lines
1.9 KiB

  1. <?php
  2. namespace App\AdminSupplier\Controllers;
  3. use App\Admin\Repositories\ProductExportLog;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Grid;
  6. use Dcat\Admin\Show;
  7. use Dcat\Admin\Http\Controllers\AdminController;
  8. class ProductExportLogController extends AdminController
  9. {
  10. /**
  11. * Make a grid builder.
  12. *
  13. * @return Grid
  14. */
  15. protected function grid()
  16. {
  17. return Grid::make(new ProductExportLog(), function (Grid $grid) {
  18. $grid->disableActions();
  19. $grid->disableCreateButton();
  20. $grid->disableBatchActions();
  21. $grid->disableRowSelector();
  22. $grid->model()->where('supplier_id', \Admin::user()->id)->orderByDesc('id');
  23. $grid->column('id')->sortable();
  24. $grid->column('filename')->downloadable();
  25. $grid->column('created_at');
  26. $grid->filter(function (Grid\Filter $filter) {
  27. $filter->equal('id')->width(2);
  28. });
  29. });
  30. }
  31. /**
  32. * Make a show builder.
  33. *
  34. * @param mixed $id
  35. *
  36. * @return Show
  37. */
  38. protected function detail($id)
  39. {
  40. return Show::make($id, new ProductExportLog(), function (Show $show) {
  41. $show->disableDeleteButton();
  42. $show->disableEditButton();
  43. $show->field('id');
  44. $show->field('filename')->file();
  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 ProductExportLog(), function (Form $form) {
  57. $form->display('id');
  58. $form->text('supplier_id');
  59. $form->text('filename');
  60. $form->display('created_at');
  61. $form->display('updated_at');
  62. })->saving(function (Form $form) {
  63. return $form->response()->error('操作禁止');
  64. })->deleting(function (Form $form) {
  65. return $form->response()->error('操作禁止');
  66. });
  67. }
  68. }