11. Community pagination

laravel pagination bulma 패키지

laravel pagination bulma

composer require revolution/laravel-pagination-bulma

php artisan vendor:publish --tag=pagination-bulma

bulma pagination 템플릿 수정

// bulma.blade.php
// is-small class 추가
<nav class="pagination is-centered is-small" role="navigation" aria-label="pagination">

bulma pagination 적용

// AppServiceProvider.php
use Illuminate\Pagination\Paginator;

public function boot()
{
  Paginator::defaultView('pagination-bulma::bulma');
  Paginator::defaultSimpleView('pagination-bulma::bulma-simple');
}

Community 컨트롤러 수정

public function index()
{
  $communities = Community::where("owner_id", auth()->id())->latest()->paginate(10);

  return view("communities.index", compact("communities"));
}

Community index view 수정

// table-container 아래에 추가
{{ $communities->onEachSide(1)->links() }}

git commit

git add .
git commit -m "feat: add laravel-pagination-bulma package"

좋은 웹페이지 즐겨찾기