UserVip.php 1.4 KB

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