1 | <?php |
||
12 | abstract class AbstractModel |
||
13 | { |
||
14 | protected $api; |
||
15 | |||
16 | protected $response; |
||
17 | |||
18 | protected $data; |
||
19 | |||
20 | protected $parent; |
||
21 | |||
22 | protected $info; |
||
23 | |||
24 | public function __construct($response, $parent) |
||
32 | |||
33 | public function toArray() |
||
37 | |||
38 | public function toJson() |
||
42 | |||
43 | /** |
||
44 | * Check if is first page of response |
||
45 | * @return bool |
||
46 | */ |
||
47 | public function isFirstPage() |
||
55 | |||
56 | /** |
||
57 | * Check if is last page of request |
||
58 | * |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function isLastPage() |
||
69 | |||
70 | /** |
||
71 | * Get total number of records |
||
72 | * @return int |
||
73 | */ |
||
74 | public function count() |
||
90 | |||
91 | /** Get total number of pages |
||
92 | * @return int |
||
93 | */ |
||
94 | public function pages() |
||
98 | |||
99 | /** |
||
100 | * Get previous page based on api response |
||
101 | * @return mixed |
||
102 | */ |
||
103 | public function prev() |
||
111 | |||
112 | /** |
||
113 | * Get next page based on api response |
||
114 | * @return mixed |
||
115 | */ |
||
116 | public function next() |
||
124 | |||
125 | public function firstPage() |
||
133 | |||
134 | public function goToPage(int $page) |
||
140 | |||
141 | public function lastPage() |
||
149 | } |
||
150 |