Skip to content

Commit 2d8e488

Browse files
committed
Paginated view example added
1 parent 835875d commit 2d8e488

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,45 @@ Paginate a message collection:
305305
/** @var \Illuminate\Pagination\LengthAwarePaginator $paginator */
306306
$paginator = $aMessage->paginate();
307307
```
308+
Blade example for a paginated list:
309+
``` php
310+
/** @var \Webklex\IMAP\Support\MessageCollection $aMessage */
311+
312+
/** @var \Illuminate\Pagination\LengthAwarePaginator $paginator */
313+
$paginator = $oFolder->search()
314+
->since(\Carbon::now()->subDays(14))->get()
315+
->paginate($perPage = 5, $page = null, $pageName = 'imap_blade_example');
316+
```
317+
``` html
318+
<table>
319+
<thead>
320+
<tr>
321+
<th>UID</th>
322+
<th>Subject</th>
323+
<th>From</th>
324+
<th>Attachments</th>
325+
</tr>
326+
</thead>
327+
<tbody>
328+
@if($paginator->count() > 0)
329+
@foreach($paginator as $oMessage)
330+
<tr>
331+
<td>{{$oMessage->getUid()}}</td>
332+
<td>{{$oMessage->getSubject()}}</td>
333+
<td>{{$oMessage->getFrom()[0]->mail}}</td>
334+
<td>{{$oMessage->getAttachments()->count() > 0 ? 'yes' : 'no'}}</td>
335+
</tr>
336+
@endforeach
337+
@else
338+
<tr>
339+
<td colspan="4">No messages found</td>
340+
</tr>
341+
@endif
342+
</tbody>
343+
</tabel>
344+
345+
{{$paginator->links()}}
346+
```
308347
> You can also paginate a Folder-, Attachment- or FlagCollection instance.
309348
310349
#### Fetch a specific message

0 commit comments

Comments
 (0)