This repository has been archived by the owner on Jan 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38774c0
commit 3adcb0c
Showing
4 changed files
with
114 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
namespace Wordpriest\Modest; | ||
|
||
use Illuminate\Support\Collection; | ||
|
||
class Pagination implements \ArrayAccess, \JsonSerializable | ||
{ | ||
public $items; | ||
|
||
public function __construct($items) | ||
{ | ||
$this->items = $items; | ||
} | ||
|
||
public function paginate($args = []) | ||
{ | ||
return paginate_links($args); | ||
} | ||
|
||
public function toArray() | ||
{ | ||
return $this->items; | ||
} | ||
|
||
public function jsonSerialize() | ||
{ | ||
return $this->toArray(); | ||
} | ||
|
||
/** | ||
* Determines whether a offset exists | ||
* | ||
* @param mixed $offset | ||
* | ||
* @return bool | ||
*/ | ||
public function offsetExists($offset) | ||
{ | ||
return isset($this->items[$offset]); | ||
} | ||
|
||
/** | ||
* Sets offset to retrieve | ||
* | ||
* @param mixed $offset | ||
* | ||
* @return mixed|null|Modest | ||
*/ | ||
public function offsetGet($offset) | ||
{ | ||
return $this->items[$offset]; | ||
} | ||
|
||
/** | ||
* Offset to set | ||
* | ||
* @param mixed $offset | ||
* @param mixed $value | ||
* | ||
* @return void | ||
*/ | ||
public function offsetSet($offset, $value) | ||
{ | ||
$this->items[$offset] = $value; | ||
} | ||
|
||
/** | ||
* Offset to unset | ||
* | ||
* @param mixed $offset | ||
*/ | ||
public function offsetUnset($offset) | ||
{ | ||
unset($this->items[$offset]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters