Use custom TeamInvitation model in TeamInvitationController#892
Use custom TeamInvitation model in TeamInvitationController#892taylorotwell merged 1 commit intolaravel:2.xfrom ManuelLeiner:patch-team-invitation-model
Conversation
driesvints
left a comment
There was a problem hiding this comment.
I also think this is probably the best solution.
|
Thanks @ManuelLeiner |
|
@driesvints I actually think that this PR might have been merged to early. As I mentioned in #890 there might be a potential breaking change as soon as someone extends from the Jetstream TeamInvitationController and overrides one of the two methods. I quickly added an example controller. What do you think? Might solution 1 (route model resolving) be safer? Should we roll back and add the change to the next major release? Or am I overthinking? |
|
@ManuelLeiner let's tackle that when someone actually reports an issue there. |
|
@driesvints I got bitten by this. It's a breaking change indeed. Luckily I did have tests to notify me of this change. For me this is fine, but I guess for people that didn't write tests for their custom endpoint, this will silently break in their production environments. |
This reverts commit aba641d.
|
@freekmurze sorry about that. We reverted this PR. @ManuelLeiner it's probably best that we retarget master for this. |
Hey @driesvints, @freekmurze, sorry for the inconveniences. Of course the next major release is perfectly fine for me/us. Anything I can do? New PR based on master? |
Yeah probably best |

Description
Use the custom
TeamInvitationclass in theacceptanddestroymethods of theTeamInvitationControllerto retrieve the invitation model.Motivation
Fixes #890.
Solution
Removes the type-hint from the controller methods. Therefore the model will not be resolved by the framework and the invitation id will be passed to the controller. Uses the invitation id and the Jetstream helper to query and retrieve an instance of the custom
TeamInvitation. UsesfirstOrFailas the route model binding responds with aModelNotFoundExceptionas well when an invalid id is passed.