<?php
namespace Root\Core\Helper;

use Illuminate\Pagination\LengthAwarePaginator;

class PaginationHelper
{
    public static function manual(array $items, int $perPage = 15): LengthAwarePaginator
    {
        $page = request()->input('page', 1);
        $offset = ($page - 1) * $perPage;
        $pagedItems = array_slice($items, $offset, $perPage);
        return new LengthAwarePaginator($pagedItems, count($items), $perPage);
    }
}
