UserChange.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Admin\Actions\Users;
  3. use App\Models\UserInfoModel;
  4. use Dcat\Admin\Admin;
  5. use Dcat\Admin\Grid\RowAction;
  6. use Dcat\Admin\Widgets\Modal;
  7. use Dcat\Admin\Widgets\Table;
  8. class UserChange extends RowAction
  9. {
  10. protected $title = '修改账户';
  11. protected $model;
  12. public function __construct(string $model = null)
  13. {
  14. $this->model = $model;
  15. }
  16. /**
  17. * 设置确认弹窗信息,如果返回空值,则不会弹出弹窗
  18. *
  19. * 允许返回字符串或数组类型
  20. *
  21. * @return array|string|void
  22. */
  23. public function confirm()
  24. {
  25. }
  26. /**
  27. * 处理请求
  28. *
  29. * @param Request $request
  30. *
  31. * @return \Dcat\Admin\Actions\Response
  32. */
  33. public function handle(Request $request)
  34. {
  35. return $this->response()
  36. ->success('Processed successfully: '.$this->getKey())
  37. ->redirect('/');
  38. }
  39. /**
  40. * 设置要POST到接口的数据
  41. *
  42. * @return array
  43. */
  44. public function parameters()
  45. {
  46. return [];
  47. }
  48. public function render()
  49. {
  50. $form = UsersInfo::make()->payload(['id'=>$this->getKey()]);
  51. return Modal::make()
  52. ->lg()
  53. ->title($this->title)
  54. ->body($form)
  55. ->button('<i class="feather icon-settings"></i> '.$this->title);
  56. }
  57. }