I wanna show how to make laravel pagination with inertia. In this topic I don't refer step by step guide but show you some controller and inertia files. Hope you can understand. Let's start it.
UsersController.php
class UsersController extends Controller
{
public function index()
{
return Inertia::render('Users', [
'users' => User::paginate(10)->through(fn($user) => [
'id' => $user->id,
'name' => $user->name
])
]);
}
}
The laravel collection of through and map methods are same approach.