RecuperateExport.php 686 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Admin\Exports\Content;
  3. use App\Admin\Exports\ViewExport;
  4. use Illuminate\Contracts\View\View;
  5. use Illuminate\Support\Collection;
  6. class RecuperateExport extends ViewExport
  7. {
  8. public $name = '';
  9. function __construct($name){
  10. $this->name = $name;
  11. }
  12. /**
  13. * 设置文件名
  14. * @return string
  15. */
  16. public function getFilename(): string
  17. {
  18. return $this->name.".xls";
  19. }
  20. /**
  21. * 渲染对应的视图
  22. * @param Collection $data 导出的数据
  23. * @return View
  24. */
  25. public function getView(Collection $data): View
  26. {
  27. return view('admin.content.export_apply', ['data'=>$data]);
  28. }
  29. }