PageApp.php 781 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace UCore\Helper;
  3. class PageApp
  4. {
  5. public int $current_page;
  6. public array $list;
  7. public int $last_page;
  8. public int $per_page;
  9. public int $total;
  10. public function __construct(\Illuminate\Pagination\LengthAwarePaginator $paginator)
  11. {
  12. $array = $paginator->toArray();
  13. // dd($array);
  14. $this->current_page = $array['current_page'];
  15. $this->list = $array['data'];
  16. $this->last_page = $array['last_page'];
  17. $this->per_page = $array['per_page'];
  18. $this->total = $array['total'];
  19. $this->has_more = ($this->current_page < $this->last_page);
  20. }
  21. static public function to(\Illuminate\Pagination\LengthAwarePaginator $paginato)
  22. {
  23. return new self($paginato);
  24. }
  25. }