海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.6 KiB

  1. <?php
  2. namespace App\Admin\Actions\Grid;
  3. use Dcat\Admin\Actions\Response;
  4. use Dcat\Admin\Grid\BatchAction;
  5. use Dcat\Admin\Traits\HasPermissions;
  6. use Illuminate\Contracts\Auth\Authenticatable;
  7. use Illuminate\Database\Eloquent\Model;
  8. use Illuminate\Http\Request;
  9. /**
  10. * 批量审核产品
  11. * Class BatchAuditProduct
  12. * @package App\Admin\Actions\Grid
  13. */
  14. class BatchAuditProduct extends BatchAction
  15. {
  16. /**
  17. * @return string
  18. */
  19. protected $title = '批量审核';
  20. public function __construct($title = null)
  21. {
  22. parent::__construct($title);
  23. }
  24. public function render()
  25. {
  26. $redirect = request()->fullUrl();
  27. return <<<HTML
  28. <a data-name="{$this->parent->getName()}"
  29. data-action="batch-delete"
  30. data-redirect="{$redirect}"
  31. data-url="{$this->resource()}"><i class="fa fa-check-square"></i> {$this->title}</a>
  32. HTML;//拒绝图标:fa-times-circle
  33. }
  34. /**
  35. * Handle the action request.
  36. *
  37. * @param Request $request
  38. *
  39. * @return Response
  40. */
  41. public function handle(Request $request)
  42. {
  43. return $this->response()
  44. ->success('Processed successfully: '.json_encode($this->getKey()))
  45. ->redirect('/');
  46. }
  47. /**
  48. * @return string|array|void
  49. */
  50. public function confirm()
  51. {
  52. // return ['Confirm?', 'contents'];
  53. }
  54. /**
  55. * @param Model|Authenticatable|HasPermissions|null $user
  56. *
  57. * @return bool
  58. */
  59. protected function authorize($user): bool
  60. {
  61. return true;
  62. }
  63. /**
  64. * @return array
  65. */
  66. protected function parameters()
  67. {
  68. return [];
  69. }
  70. }