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

Override route key name if $primaryKey is overridden #630

Merged
merged 4 commits into from Apr 20, 2023
Merged

Override route key name if $primaryKey is overridden #630

merged 4 commits into from Apr 20, 2023

Conversation

Jared0430
Copy link
Contributor

Currently, if you use a custom primary key on your model, you also have to override the getRouteKeyName() method, otherwise, the custom route key name doesn't get detected

This PR fixes this by also checking if the $primaryKey property has been set on your model

@bakerkretzmar
Copy link
Collaborator

Thanks, good catch 👍🏻 can you add a test for this, and also add getKeyName() since we should probably be checking that too? I can circle back and add a test here in the next week or two as well, no rush.

@bakerkretzmar bakerkretzmar self-assigned this Apr 20, 2023
@Jared0430
Copy link
Contributor Author

Added support for getKeyName() and some tests 👍

@bakerkretzmar bakerkretzmar merged commit 396516d into tighten:main Apr 20, 2023
48 checks passed
@bakerkretzmar
Copy link
Collaborator

Thanks a lot! I'll tag a release in the next day or two.

@Jared0430 Jared0430 deleted the patch-1 branch April 20, 2023 20:36
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.

None yet

2 participants