DEV Community

Robert Look
Robert Look

Posted on

Livewire Pagination / How To Create Livewire Pagination Example

In this tutorial, we will create simple pagination using laravel livewire using PHP artisan livewire. you can use laravel livewire pagination with all versions.

Livewire is a full-stack framework for Laravel framework then uses laravel livewire pagination that makes building dynamic interfaces and use simple, without leaving the comfort of Laravel. if you are using livewire with laravel then you don't worry about writing any code like jquery ajax etc, livewire will help to write very simple way jquery ajax code using PHP. without page refresh laravel validation will work, the form will submit, etc.

Livewire Pagination / How To Create Livewire Pagination Example

<?php

namespace App\Http\Livewire;

use Livewire\Component;
use Livewire\WithPagination;
use App\Models\User;

class UserPagination extends Component
{
    use WithPagination;

    /**
     * Write code on Method
     *
     * @return response()
     */
    public function render()
    {
        return view('livewire.user-pagination', [
            'users' => User::paginate(10),
        ]);
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)