This repository was archived by the owner on Jul 24, 2023. It is now read-only.
This repository was archived by the owner on Jul 24, 2023. It is now read-only.
Pagniate works irrespective of the limit params #333
Open
Description
- Laravel Version: 5.3
- Adldap2-Laravel Version: 3.0
- PHP Version: 7.0
Description:
The paginate function works irrespective of the records per page and current page params.
I have made the records per page and current page params as dynamic and following is the code,
$ad = new \Adldap\Adldap();
if ($offset==0) {
$currentPage = 1;
} else {
$offset = ($offset/$limit);
$currentPage = $offset+1;
}
$ad->addProvider($config);
$provider = $ad->connect();
$search = $provider->search();
$recordsPerPage = $limit;
$adUsers = $search->users()->sortBy('cn', 'asc')
->paginate($recordsPerPage, $currentPage)
->getResults();
For example, if the records per page is 50 and current page is 1, it should return me only 50 records from the beginning, but the above code returns me all the records, exactly 874 records in the AD.
Help will be really appreciated. Thanks