dev-think-one /
laravel-reviewsio-api
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Reviewsio\Endpoints; |
||
| 4 | |||
| 5 | trait HasResponsePagination |
||
| 6 | { |
||
| 7 | abstract protected function entityKey(): string; |
||
| 8 | |||
| 9 | 1 | public function total(): int |
|
| 10 | { |
||
| 11 | 1 | return (int) $this->baseResponse()->json("{$this->entityKey()}.total", 0); |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 12 | } |
||
| 13 | |||
| 14 | 1 | public function perPage(): int |
|
| 15 | { |
||
| 16 | 1 | return (int) $this->baseResponse()->json("{$this->entityKey()}.per_page", 0); |
|
| 17 | } |
||
| 18 | |||
| 19 | 1 | public function currentPage(): int |
|
| 20 | { |
||
| 21 | 1 | return (int) $this->baseResponse()->json("{$this->entityKey()}.current_page", 0); |
|
| 22 | } |
||
| 23 | |||
| 24 | 1 | public function lastPage(): int |
|
| 25 | { |
||
| 26 | 1 | return (int) $this->baseResponse()->json("{$this->entityKey()}.last_page", 0); |
|
| 27 | } |
||
| 28 | |||
| 29 | 1 | public function from(): int |
|
| 30 | { |
||
| 31 | 1 | return (int) $this->baseResponse()->json("{$this->entityKey()}.from", 0); |
|
| 32 | } |
||
| 33 | |||
| 34 | 1 | public function to(): int |
|
| 35 | { |
||
| 36 | 1 | return (int) $this->baseResponse()->json("{$this->entityKey()}.to", 0); |
|
| 37 | } |
||
| 38 | |||
| 39 | 1 | public function items(): array |
|
| 40 | { |
||
| 41 | 1 | return $this->baseResponse()->json("{$this->entityKey()}.data", []); |
|
| 42 | } |
||
| 43 | } |
||
| 44 |