tobyzerner / json-api-server

A JSON:API server implementation in PHP.
https://tobyzerner.github.io/json-api-server/
MIT License
63 stars 21 forks source link

feat: allow including relationships by default #96

Closed SychO9 closed 3 months ago

SychO9 commented 5 months ago

Hello 👋🏼,

This is a beautifully written package, it has been great working with 🙏🏼.

We have come across a use case where we need some relations included by default. We currently have to maintain a fork of our own due to some very unique edge case behavior that probably don't make sense having in the origin repository.

I am not sure if you would want to support default includes, but thought I'd send this your way just in case. Will probably push more for other changes that might make sense to contribute back as well.


This would work per endpoint:

Endpoint\Show::make()
    ->defaultInclude(['groups', 'actor'])