UserChange.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. $this->title = trans('user.fields.modify_account');
  16. }
  17. /**
  18. * 设置确认弹窗信息,如果返回空值,则不会弹出弹窗
  19. *
  20. * 允许返回字符串或数组类型
  21. *
  22. * @return array|string|void
  23. */
  24. public function confirm()
  25. {
  26. }
  27. /**
  28. * 处理请求
  29. *
  30. * @param Request $request
  31. *
  32. * @return \Dcat\Admin\Actions\Response
  33. */
  34. public function handle(Request $request)
  35. {
  36. return $this->response()
  37. ->success('Processed successfully: '.$this->getKey())
  38. ->redirect('/');
  39. }
  40. /**
  41. * 设置要POST到接口的数据
  42. *
  43. * @return array
  44. */
  45. public function parameters()
  46. {
  47. return [];
  48. }
  49. public function render()
  50. {
  51. $form = UsersInfo::make()->payload(['id'=>$this->getKey()]);
  52. return Modal::make()
  53. ->lg()
  54. ->title($this->title)
  55. ->body($form)
  56. ->button('<i class="feather icon-settings"></i> '.$this->title);
  57. }
  58. }