-
I'm a little taken aback by implicit binding in Laravel 7+. Consider the following route:
Sending the following request:
The output is as expected:
But if implicit binding is substituted in the route:
Then the output adds the bound object before the first bound field rather than replacing it, effectively ignoring the last element in the request.
I can't imagine that's the expected behaviour. Is there a way to make the object replace the provided parameter in the bindings, rather than prepending it to the bindings? What's the correct way to bind the object without it dropping off the last parameter? Do all bindings need to be either objects, or primitive types, for bindings to work correctly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The issue was that I was missing the SubstituteBindings middleware.
Now, as expected, the objects are substituted rather than prepended:
|
Beta Was this translation helpful? Give feedback.
The issue was that I was missing the SubstituteBindings middleware.
Now, as expected, the objects are substituted rather than prepended: