FromViewExportWithMultipleSheets.php 826 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Maatwebsite\Excel\Tests\Data\Stubs;
  3. use Illuminate\Support\Collection;
  4. use Maatwebsite\Excel\Concerns\Exportable;
  5. use Maatwebsite\Excel\Concerns\WithMultipleSheets;
  6. class FromViewExportWithMultipleSheets implements WithMultipleSheets
  7. {
  8. use Exportable;
  9. /**
  10. * @var Collection
  11. */
  12. protected $users;
  13. /**
  14. * @param Collection $users
  15. */
  16. public function __construct(Collection $users)
  17. {
  18. $this->users = $users;
  19. }
  20. /**
  21. * @return SheetForUsersFromView[]
  22. */
  23. public function sheets(): array
  24. {
  25. return [
  26. new SheetForUsersFromView($this->users->forPage(1, 100)),
  27. new SheetForUsersFromView($this->users->forPage(2, 100)),
  28. new SheetForUsersFromView($this->users->forPage(3, 100)),
  29. ];
  30. }
  31. }