Skip to content
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

feat: conditional linkage #110

Merged
merged 2 commits into from
Nov 1, 2024

Conversation

SychO9
Copy link
Contributor

@SychO9 SychO9 commented May 10, 2024

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

@tobyzerner tobyzerner merged commit ffc7d7f into tobyzerner:main Nov 1, 2024
2 of 3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants