Skip to content

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

Open
@lindyhopchris

Description

@lindyhopchris

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions