Pagination
Making pagination with laravel inertia
class UsersController extends Controller
{
public function index()
{
return Inertia::render('Users', [
'users' => User::paginate(10)->through(fn($user) => [
'id' => $user->id,
'name' => $user->name
])
]);
}
}<template>
<div>
<Component
:is="link.url ? 'Link' : 'span'"
v-for="link in links"
:href="link.url"
v-html="link.label"
class="px-1"
:class="{ 'text-gray-500': ! link.url, 'font-bold' : link.active }"
/>
</div>
</template>
<script>
export default {
props: {
links: Array
}
};
</script>Last updated