masonite icon indicating copy to clipboard operation
masonite copied to clipboard

Route Model Binding

Open Vringe opened this issue 3 years ago • 0 comments

Is your feature request related to a problem?

It would be very useful to have Route Model Binding, similar to what Laravel has.

What do we currently have to do now?

Currently, you have to retrieve the model by hand.

Describe the solution you'd like

Something like this:

routes/web.py:

Route.get('users/{user}', 'UserController@show')

app/controllers/UserController.py:

    from app.models.User import User
    def show(self, user: User):
        return user

Describe alternatives you've considered

No response

Would this be a breaking change ?

  • [ ] Yes

Anything else ?

No response

Vringe avatar Sep 22 '22 15:09 Vringe