0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Laravel 簡単なページネーション機能を作成

Posted at

Laravelには、とても便利なページネーション機能があります。
今回はEloquentモデルで実装してみたいと思います。

やり方
1 コントローラーに以下を追加する

:paginate(10);

2 viewに$usersを渡してあげて表示する

3 ページ番号の前と後の矢印を表示するために、
viewに {{ $users -> links(); }} を書いてあげる

これだけでページネーション機能を作れるので楽ですね。

参考サイト; https://readouble.com/laravel/5.3/ja/pagination.html

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?