Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top level Meta for Collection #16

Closed
snellingio opened this issue May 31, 2022 · 4 comments
Closed

Top level Meta for Collection #16

snellingio opened this issue May 31, 2022 · 4 comments

Comments

@snellingio
Copy link
Contributor

Even though this is specifically in the To Do section, I'm making an issue for it to bump the urgency of it as I need it to pass back some additional data.

I am imagining an API that looks something like this:
Resource::collection($data)->withMeta($meta)

Again, if @timacdonald has a specific implementation in mind, let me know. If it sounds good in theory, I can try to take a stab at it.

@timacdonald
Copy link
Owner

Hey, just a heads up I'll be merging support for this shortly!

@timacdonald
Copy link
Owner

This is the exact API that will land in v1. Docs are being written at the moment. Thanks Sam.

@lloricode
Copy link

hi @timacdonald is this possible today? can not see on docs, thank you

@lloricode
Copy link

currently this way works

        return ItemResource::collection(
            // ...
        )
            ->additional([ // << -----
                'meta' => [
                    'test_key' => 'test_value',
                ],
            ]);
 "meta": {
        // ...
        "test_key": "test_value"
    },

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

No branches or pull requests

3 participants