CashOutController.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Repositories\CashOut;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Grid;
  6. use Dcat\Admin\Show;
  7. use Dcat\Admin\Http\Controllers\AdminController;
  8. class CashOutController extends AdminController
  9. {
  10. /**
  11. * Make a grid builder.
  12. *
  13. * @return Grid
  14. */
  15. protected function grid()
  16. {
  17. return Grid::make(new CashOut(), function (Grid $grid) {
  18. $grid->column('id')->sortable();
  19. $grid->column('member_id');
  20. $grid->column('price');
  21. $grid->column('status');
  22. $grid->column('comment');
  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 CashOut(), function (Show $show) {
  40. $show->field('id');
  41. $show->field('member_id');
  42. $show->field('price');
  43. $show->field('status');
  44. $show->field('comment');
  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 CashOut(), function (Form $form) {
  57. $form->display('id');
  58. $form->text('member_id');
  59. $form->text('price');
  60. $form->text('status');
  61. $form->text('comment');
  62. $form->display('created_at');
  63. $form->display('updated_at');
  64. });
  65. }
  66. }