json-api-server icon indicating copy to clipboard operation
json-api-server copied to clipboard

feat: conditional linkage

Open SychO9 opened this issue 9 months ago • 0 comments

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);
     })

SychO9 avatar May 10 '24 15:05 SychO9