php-imap
php-imap copied to clipboard
Pagination error
trafficstars
Anyone experience this error Fatal error: Uncaught Error: Call to a member function make() on null in vendor/illuminate/pagination/LengthAwarePaginator.php:91?
This is my sample code:
$cm = new \Webklex\PHPIMAP\ClientManager([]);
$client = $cm->make([
'host' => $imap_settings['host'],
'port' => $imap_settings['port'],
'encryption' => 'ssl',
'validate_cert' => true,
'username' => $imap_settings['username'],
'password' => $imap_settings['password'],
'protocol' => 'imap'
]);
$client->connect();
$inbox = $client->getFolder('INBOX');
$messages = $inbox->messages();
$paginator = $messages->all()->paginate(5, 1);
$paginator->links() // This is where the error occur
@kmligue Hi, I was looking for an answer to my question, and since I managed to make pagination I decided to throw you my way. I will be glad if I can help solve the problem.
$folders = $this->client->getFolders();
$folders[0]->messages()->setFetchOrderDesc()->limit($maxResult, $page)->all()->get();
By the way, there most likely first "paginate" and then "all"
$messages->paginate($maxResult, $page)->all()
Hi @kmligue , many thanks for your report. Can you provide any additional context such as the callstack? I'm currently unable to reproduce this issue.
Best regards,