json-api-server
json-api-server copied to clipboard
feat: conditional linkage
We have a use case where we need to enable linkage for a ToMany relation, but only when the Show endpoint is related to the resource itself and not another (another can be when inclusion is in effect instead).
So we do something along the lines of
ToMany::make('posts')
->withLinkage(function (Context $context) {
return $context->showing(self::class);
})