Skip to content

document withoutMiddleware to avoid disable route binding gotcha #4677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jtallant
Copy link
Contributor

It seems obvious now but it was very frustrating having the route binding disabled when disabling all middleware. Sometimes I like to start writing tests in a very basic way and not worrying about middleware at all until later. I do that now by only disabling specific middleware but this took me a bit to figure out. Other people have had the same issue.

laravel/framework#16260

I would recommend just keeping the route binding middleware on when calling withoutMiddleware and then deleting this doc. Makes a lot more sense to me but others disagree. It should at least be documented if it's going to be that way.

@taylorotwell
Copy link
Member

Personally I don't want to document disabling middleware at all. IMO it's a bad idea and generally leads to bugs. You should test your routes with their full middleware.

@SachinAgarwal1337
Copy link

@taylorotwell I agree, but there are situations where disabling middleware is required. For example when I am testing the route with signed middleware. where I want to just test the call the route without creating the signed route in my test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants