Skip to content

Conversation

Freezon
Copy link

@Freezon Freezon commented Aug 14, 2025

#2313

Functionality for using Laravel ResourceCollections with Pagination, without destroying the meta.links array.

Might be useful for other arrays too.

public function index(Request $request): Response
    {
        return Inertia::render('users/list', [
            'items' => Inertia::deepMerge(UserResource::collection(User::paginate()))
                ->matchOn(['data.id', '!meta.links']),
        ]);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant