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