I am using the page of Laravel with order by desc and I indicate that 5 elements are displayed. When returning 7 the first page shows me 2 and the second 5. I want the first one to be filled before the second. If I use ASC it works correctly.
Controller:
public function list(){
$questions = Question::orderBy('id', 'DESC')->paginate(5);
return view('web.pages.list', compact('questions'));
}
Vista:
@foreach ($questions as $q)
<a href="/list//">
<div class="container-list-question">
<div class="header-category-list-question">
<span></span>
</div>
<div class="data-question">
Autor:
</div>
<div class="title-list-question">
<span></span>
<div class="btn-show"> Show question</div>
</div>
</div>
</a>
@endforeach
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2SudF4X
via IFTTT
Aucun commentaire:
Enregistrer un commentaire