Skip to content

Investigate using the new automatic eager loading feature to simplify loading #311

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

Open
lindyhopchris opened this issue Apr 9, 2025 · 0 comments
Assignees

Comments

@lindyhopchris
Copy link
Contributor

At the moment the package has to do quite complex work to get Eloquent to eager load the right paths based on JSON:API include paths. This represents significant complexity in the package implementation.

There is a new feature in Laravel 12 for Eloquent to automatically eager load relations, added via this PR and documented here.

Worth noting, at the time of writing the docs say this feature is in beta awaiting community feedback and might change.

The main limitation at the moment is it'll load all attributes of related models, whereas the aim was to move to only loading specific columns if JSON:API sparse fieldsets have been added.

Note that we wouldn't want to turn this on globally for all models, we'd want to call the specific method on the model or model collection that the JSON:API implementation loads.

@lindyhopchris lindyhopchris self-assigned this Apr 9, 2025
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

No branches or pull requests

1 participant