CursorPaginator.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. namespace Illuminate\Contracts\Pagination;
  3. interface CursorPaginator
  4. {
  5. /**
  6. * Get the URL for a given cursor.
  7. *
  8. * @param \Illuminate\Pagination\Cursor|null $cursor
  9. * @return string
  10. */
  11. public function url($cursor);
  12. /**
  13. * Add a set of query string values to the paginator.
  14. *
  15. * @param array|string|null $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|null
  25. */
  26. public function fragment($fragment = null);
  27. /**
  28. * Add all current query string values to the paginator.
  29. *
  30. * @return $this
  31. */
  32. public function withQueryString();
  33. /**
  34. * Get the URL for the previous page, or null.
  35. *
  36. * @return string|null
  37. */
  38. public function previousPageUrl();
  39. /**
  40. * The URL for the next page, or null.
  41. *
  42. * @return string|null
  43. */
  44. public function nextPageUrl();
  45. /**
  46. * Get all of the items being paginated.
  47. *
  48. * @return array
  49. */
  50. public function items();
  51. /**
  52. * Get the "cursor" of the previous set of items.
  53. *
  54. * @return \Illuminate\Pagination\Cursor|null
  55. */
  56. public function previousCursor();
  57. /**
  58. * Get the "cursor" of the next set of items.
  59. *
  60. * @return \Illuminate\Pagination\Cursor|null
  61. */
  62. public function nextCursor();
  63. /**
  64. * Determine how many items are being shown per page.
  65. *
  66. * @return int
  67. */
  68. public function perPage();
  69. /**
  70. * Get the current cursor being paginated.
  71. *
  72. * @return \Illuminate\Pagination\Cursor|null
  73. */
  74. public function cursor();
  75. /**
  76. * Determine if there are enough items to split into multiple pages.
  77. *
  78. * @return bool
  79. */
  80. public function hasPages();
  81. /**
  82. * Get the base path for paginator generated URLs.
  83. *
  84. * @return string|null
  85. */
  86. public function path();
  87. /**
  88. * Determine if the list of items is empty or not.
  89. *
  90. * @return bool
  91. */
  92. public function isEmpty();
  93. /**
  94. * Determine if the list of items is not empty.
  95. *
  96. * @return bool
  97. */
  98. public function isNotEmpty();
  99. /**
  100. * Render the paginator using a given view.
  101. *
  102. * @param string|null $view
  103. * @param array $data
  104. * @return string
  105. */
  106. public function render($view = null, $data = []);
  107. }