Level 51
It's like this
'users' => \App\Models\User::select('id', 'name')->paginate(10)
Why you were using all with pagination?
2 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Why is it that I can not use the bottom syntax.
return Inertia::render('Users', [
'users' => \App\Models\User::paginate(10)->through(fn($user) => [
'id' => $user->id,
'name' => $user->name,
]),
]);
return Inertia::render('Users', [
'users' => \App\Models\User::select('id', 'name')->paginate(10)->all(),
]);
It's like this
'users' => \App\Models\User::select('id', 'name')->paginate(10)
Why you were using all with pagination?
Please or to participate in this conversation.