Closed afshiney closed 2 years ago
Any chance we can add some tests to verify the behaviour? i.e. that the binding works on the default column, a custom value, and that it correctly returns a 404 when the model cannot be found?
Of course, just pushed the latest commit that contains the required tests.
I added a getRouteKeyName(): string
method to the BindsOnUuid
trait as well. If we're going to support implicit binding, we should support it on the named routes as well. Readme updated to reflect this change, too.
I also tweaked the it_fails_on_invalid_uuid_when_custom_route_key_used
test as it looked like it had been copy/pasted from the test above but not updated.
When used on model, the added trait adds the ability to route bind the model to desired uuid column, As an example:
Above code would bind on default 'uuid' column name and perform under "whereUuid" scope.
Also in case model has more than one uuid column and/or any name other than 'uuid' is set for column, the added trait feeds the custom column name to responsible scope:
As usual custom columns should be registered within "uuidColumns" function.