WithdrawReview.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Admin\Actions\Form;
  3. use App\Models\UserEpisodesRecord;
  4. use App\Models\UserWithdraw;
  5. use Dcat\Admin\Contracts\LazyRenderable;
  6. use Dcat\Admin\Traits\LazyWidget;
  7. use Dcat\Admin\Widgets\Form;
  8. class WithdrawReview extends Form implements LazyRenderable
  9. {
  10. use LazyWidget;
  11. public function handle(array $input)
  12. {
  13. $status = $input['status'];
  14. try {
  15. $withdraw = UserWithdraw::find($input['id']);
  16. if ($status > 0) {
  17. $withdraw->status = $status;
  18. $withdraw->save();
  19. }
  20. } catch (\Exception $exception) {
  21. return $this->response()->error($exception->getMessage());
  22. }
  23. return $this->response()->success('success')->refresh();
  24. }
  25. public function form()
  26. {
  27. $id = isset($this->payload['id']) ? $this->payload['id'] : 0;
  28. $this->hidden('id')->value($id);
  29. $this->radio('status', '审核结果')
  30. ->options(config('global.withdraw_status'))->default(1);
  31. $this->disableResetButton();
  32. }
  33. }