| 1 | <?php |
| 2 | |
| 3 | namespace Illuminate\Contracts\Pagination; |
| 4 | |
| 5 | /** |
| 6 | * @template TKey of array-key |
| 7 | * |
| 8 | * @template-covariant TValue |
| 9 | * |
| 10 | * @method $this through(callable(TValue): mixed $callback) |
| 11 | */ |
| 12 | interface CursorPaginator |
| 13 | { |
| 14 | /** |
| 15 | * Get the URL for a given cursor. |
| 16 | * |
| 17 | * @param \Illuminate\Pagination\Cursor|null $cursor |
| 18 | * @return string |
| 19 | */ |
| 20 | public function url($cursor); |
| 21 | |
| 22 | /** |
| 23 | * Add a set of query string values to the paginator. |
| 24 | * |
| 25 | * @param array|string|null $key |
| 26 | * @param string|null $value |
| 27 | * @return $this |
| 28 | */ |
| 29 | public function appends($key, $value = null); |
| 30 | |
| 31 | /** |
| 32 | * Get / set the URL fragment to be appended to URLs. |
| 33 | * |
| 34 | * @param string|null $fragment |
| 35 | * @return $this|string|null |
| 36 | */ |
| 37 | public function fragment($fragment = null); |
| 38 | |
| 39 | /** |
| 40 | * Add all current query string values to the paginator. |
| 41 | * |
| 42 | * @return $this |
| 43 | */ |
| 44 | public function withQueryString(); |
| 45 | |
| 46 | /** |
| 47 | * Get the URL for the previous page, or null. |
| 48 | * |
| 49 | * @return string|null |
| 50 | */ |
| 51 | public function previousPageUrl(); |
| 52 | |
| 53 | /** |
| 54 | * The URL for the next page, or null. |
| 55 | * |
| 56 | * @return string|null |
| 57 | */ |
| 58 | public function nextPageUrl(); |
| 59 | |
| 60 | /** |
| 61 | * Get all of the items being paginated. |
| 62 | * |
| 63 | * @return array<TKey, TValue> |
| 64 | */ |
| 65 | public function items(); |
| 66 | |
| 67 | /** |
| 68 | * Get the "cursor" of the previous set of items. |
| 69 | * |
| 70 | * @return \Illuminate\Pagination\Cursor|null |
| 71 | */ |
| 72 | public function previousCursor(); |
| 73 | |
| 74 | /** |
| 75 | * Get the "cursor" of the next set of items. |
| 76 | * |
| 77 | * @return \Illuminate\Pagination\Cursor|null |
| 78 | */ |
| 79 | public function nextCursor(); |
| 80 | |
| 81 | /** |
| 82 | * Determine how many items are being shown per page. |
| 83 | * |
| 84 | * @return int |
| 85 | */ |
| 86 | public function perPage(); |
| 87 | |
| 88 | /** |
| 89 | * Get the current cursor being paginated. |
| 90 | * |
| 91 | * @return \Illuminate\Pagination\Cursor|null |
| 92 | */ |
| 93 | public function cursor(); |
| 94 | |
| 95 | /** |
| 96 | * Determine if there are enough items to split into multiple pages. |
| 97 | * |
| 98 | * @return bool |
| 99 | */ |
| 100 | public function hasPages(); |
| 101 | |
| 102 | /** |
| 103 | * Determine if there are more items in the data source. |
| 104 | * |
| 105 | * @return bool |
| 106 | */ |
| 107 | public function hasMorePages(); |
| 108 | |
| 109 | /** |
| 110 | * Get the base path for paginator generated URLs. |
| 111 | * |
| 112 | * @return string|null |
| 113 | */ |
| 114 | public function path(); |
| 115 | |
| 116 | /** |
| 117 | * Determine if the list of items is empty or not. |
| 118 | * |
| 119 | * @return bool |
| 120 | */ |
| 121 | public function isEmpty(); |
| 122 | |
| 123 | /** |
| 124 | * Determine if the list of items is not empty. |
| 125 | * |
| 126 | * @return bool |
| 127 | */ |
| 128 | public function isNotEmpty(); |
| 129 | |
| 130 | /** |
| 131 | * Render the paginator using a given view. |
| 132 | * |
| 133 | * @param string|null $view |
| 134 | * @param array $data |
| 135 | * @return string |
| 136 | */ |
| 137 | public function render($view = null, $data = []); |
| 138 | } |