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

added the ability to use resolveRelationUsing and still use the package #36

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

danilogiacomi
Copy link
Contributor

If you add a relation to a model via the Model::resolveRelationUsing() method (https://laravel.com/docs/11.x/eloquent-relationships#dynamic-relationships) the getRelation() methods in QueryToMany, QueryToOne, HasMany, HasOne, BelongsTo and BelongsToMany don't recognize it as they use method_exists to check if it's available, whereas the relations created this way are only available to the instance and when checked with relationResolver.

Added the checks with relationResolver to all the relevant places

Copy link
Contributor

@lindyhopchris lindyhopchris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lindyhopchris lindyhopchris merged commit 12c4116 into laravel-json-api:develop Jun 26, 2024
2 checks passed
@lindyhopchris
Copy link
Contributor

Thank you for the PR! Tagged as v4.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants