framework
framework copied to clipboard
[proposal] Paginator isEmpty
I created a list off all my clients. First off, I retrieved my clients from the database and sent it to a view:
Client::all();
When there are no clients, I show an message that we do not have any clients yet. So I am using the isEmpty() function:
<table class="table table-striped table-bordered margin-top">
<thead>
<tr>
......
</tr>
</thead>
<tbody>
@if ($clients->isEmpty())
<tr>
.......
</tr>
@endif
@foreach ($clients as $client)
<tr>
......
</tr>
@endforeach
</tbody>
</table>
Now I wanted to include pagination, So I changed:
Client::all();
to
Client::paginate(10);
Unfortunately, I am now getting this error:
FatalErrorException: Error: Call to undefined method Illuminate\Pagination\Paginator::isEmpty()
I could use count() or getTotal() to check if I got any results. But wouldn't it make any sense if there was also an isEmpty() function?
Sure. I'll look into adding it or someone can pull request it.