Paginator.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. namespace Illuminate\Contracts\Pagination;
  3. interface Paginator
  4. {
  5. /**
  6. * Get the URL for a given page.
  7. *
  8. * @param int $page
  9. * @return string
  10. */
  11. public function url($page);
  12. /**
  13. * Add a set of query string values to the paginator.
  14. *
  15. * @param array|string $key
  16. * @param string|null $value
  17. * @return $this
  18. */
  19. public function appends($key, $value = null);
  20. /**
  21. * Get / set the URL fragment to be appended to URLs.
  22. *
  23. * @param string|null $fragment
  24. * @return $this|string
  25. */
  26. public function fragment($fragment = null);
  27. /**
  28. * The URL for the next page, or null.
  29. *
  30. * @return string|null
  31. */
  32. public function nextPageUrl();
  33. /**
  34. * Get the URL for the previous page, or null.
  35. *
  36. * @return string|null
  37. */
  38. public function previousPageUrl();
  39. /**
  40. * Get all of the items being paginated.
  41. *
  42. * @return array
  43. */
  44. public function items();
  45. /**
  46. * Get the "index" of the first item being paginated.
  47. *
  48. * @return int
  49. */
  50. public function firstItem();
  51. /**
  52. * Get the "index" of the last item being paginated.
  53. *
  54. * @return int
  55. */
  56. public function lastItem();
  57. /**
  58. * Determine how many items are being shown per page.
  59. *
  60. * @return int
  61. */
  62. public function perPage();
  63. /**
  64. * Determine the current page being paginated.
  65. *
  66. * @return int
  67. */
  68. public function currentPage();
  69. /**
  70. * Determine if there are enough items to split into multiple pages.
  71. *
  72. * @return bool
  73. */
  74. public function hasPages();
  75. /**
  76. * Determine if there is more items in the data store.
  77. *
  78. * @return bool
  79. */
  80. public function hasMorePages();
  81. /**
  82. * Determine if the list of items is empty or not.
  83. *
  84. * @return bool
  85. */
  86. public function isEmpty();
  87. /**
  88. * Determine if the list of items is not empty.
  89. *
  90. * @return bool
  91. */
  92. public function isNotEmpty();
  93. /**
  94. * Render the paginator using a given view.
  95. *
  96. * @param string|null $view
  97. * @param array $data
  98. * @return string
  99. */
  100. public function render($view = null, $data = []);
  101. }