Custom implicit route child model resolution #39779
Unanswered
marvin-wtt
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to implement a custom implicit model resolution to allow support for localized slugs. To accomplish that I simply override the
resolveRouteBinding
function of the model.framework/src/Illuminate/Database/Eloquent/Model.php
Lines 1871 to 1881 in e4b54ba
This works great as long as long as the model is not in a relationship or it is the parent of it.
If the model is a child in a relationship,
resolveChildRouteBindingQuery
of the parent model is called instead and the model cannot be resolved.framework/src/Illuminate/Database/Eloquent/Model.php
Lines 1921 to 1941 in e4b54ba
Does anyone have an idea on how to solve this problem?
One idea I had was add
resolveRouteBindingQuery
to the model and call it fromresolveChildRouteBindingQuery
but I was unable to retrieve the child model from the relationship.Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions