海南旅游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.

59 lines
1.0 KiB

  1. <?php
  2. namespace App\AdminSupplier\Actions\Grid;
  3. use Dcat\Admin\Grid\Tools\AbstractTool;
  4. use Dcat\Admin\Traits\HasPermissions;
  5. use Illuminate\Contracts\Auth\Authenticatable;
  6. use Illuminate\Database\Eloquent\Model;
  7. class ImportFromExcelButton extends AbstractTool
  8. {
  9. /**
  10. * @return string
  11. */
  12. protected $title = '从Excel导入';
  13. public function html()
  14. {
  15. $this->appendHtmlAttribute('class', 'btn btn-primary btn-outline');
  16. return <<<HTML
  17. <a {$this->formatHtmlAttributes()}>{$this->title()}</a>
  18. HTML;
  19. }
  20. /**
  21. * @return string|void
  22. */
  23. protected function href()
  24. {
  25. return admin_url('product/import');
  26. }
  27. /**
  28. * @return string|array|void
  29. */
  30. public function confirm()
  31. {
  32. // return ['Confirm?', 'contents'];
  33. }
  34. /**
  35. * @param Model|Authenticatable|HasPermissions|null $user
  36. *
  37. * @return bool
  38. */
  39. protected function authorize($user): bool
  40. {
  41. return true;
  42. }
  43. /**
  44. * @return array
  45. */
  46. protected function parameters()
  47. {
  48. return [];
  49. }
  50. }