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. class UserVip extends RowAction
  7. {
  8. protected $title = '<i class="feather icon-award"></i> 设置VIP';
  9. protected $model;
  10. public function __construct(string $model = null)
  11. {
  12. $this->model = $model;
  13. }
  14. /**
  15. * 设置确认弹窗信息,如果返回空值,则不会弹出弹窗
  16. *
  17. * 允许返回字符串或数组类型
  18. *
  19. * @return array|string|void
  20. */
  21. public function confirm()
  22. {
  23. // return [
  24. // "确定改变认证状态吗?"
  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 = UserVipForm::make()->payload(['id'=>$this->getKey()]);
  52. return Modal::make()
  53. ->lg()
  54. ->title($this->title)
  55. ->body($form)
  56. ->button($this->title);
  57. }
  58. }