Laravel Array Pagination

function paginateArray($data, $perPage, $page = null)
{
$page = $page ? (int) $page * 1 : (isset($_REQUEST[‘page’]) ? (int) $_REQUEST[‘page’] * 1 : 1);
$offset = ($page * $perPage) – $perPage;
return Paginator::make(array_slice($data, $offset, $perPage, true), count($data), $perPage);
}

B logbook : PHP | Javascript | Laravel | CodeIgniter | VueJs | ReactJs | WordPress

Translate »