I am beginner in Laravel and php. I try show list articles with pagination.
I have controller:
public function poradnik(Request $request)
{
MetaTag::set('title', 'name.pl | xxxxx');
MetaTag::set('description', 'name.pl | xxxxx');
MetaTag::set('keywords', 'name.pl | xxxxx');
$data = [
[
'title' => 'Strona Internetowa, jak Odnieść Sukces?',
'desc' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vestibulum luctus ex. Morbi sollicitudin condimentum ante, vel euismod quam rhoncus nec. Ut consectetur convallis libero, ut venenatis libero sagittis ac. Sed hendrerit risus quis luctus dignissim. Morbi tincidunt tempus enim, at volutpat leo placerat sed. Aliquam pharetra dolor faucibus, posuere lacus sit amet, venenatis nulla...',
'url' => 'poradnik-strona-internetowa-jak-odniesc-sukces'
],
[
'title' => 'Znaczenie Linków w Budowaniu Pozycji Strony',
'desc' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vestibulum luctus ex. Morbi sollicitudin condimentum ante, vel euismod quam rhoncus nec. Ut consectetur convallis libero, ut venenatis libero sagittis ac. Sed hendrerit risus quis luctus dignissim. Morbi tincidunt tempus enim, at volutpat leo placerat sed. Aliquam pharetra dolor faucibus, posuere lacus sit amet, venenatis nulla...',
'url' => 'poradnik-znaczenie-linkow-w-budowaniu-pozycji-strony'
],
[
'title' => 'Planowanie Sklepu Internetowego',
'desc' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vestibulum luctus ex. Morbi sollicitudin condimentum ante, vel euismod quam rhoncus nec. Ut consectetur convallis libero, ut venenatis libero sagittis ac. Sed hendrerit risus quis luctus dignissim. Morbi tincidunt tempus enim, at volutpat leo placerat sed. Aliquam pharetra dolor faucibus, posuere lacus sit amet, venenatis nulla...',
'url' => 'poradnik-planowanie-sklepu-internetowego'
]
.........
];
return view('frontend.poradnik.index', ['data' => $data]);
}
(243 records)
View:
@foreach($data as $value)
<li class="guide-item">
<a href="">
<h2></h2></a>
<a href=""><p
class="justify-text">
</p></a>
</li>
@endforeach
<nav aria-label="Page navigation">
<ul class="pagination">
<li class="page-item"><a class="page-link" href="#" aria-label="Previous"></a></li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item"><a class="page-link" href="#" aria-label="Next"></a></li>
</ul>
</nav>
How can I add paginate to my code? I need limit 4 records per page. I use Laravel 6 :)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire