-
Notifications
You must be signed in to change notification settings - Fork 11.3k
can() method does not work for route groups #55114
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
Comments
Can you point where exactly this is available in Laravel documentation? |
Sure: https://laravel.com/docs/11.x/authorization#via-middleware. The example shows usage on a single route without using groups, however the |
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
This comment has been minimized.
This comment has been minimized.
Hi, can I work on this? |
@rohDevellopper Feel free to open a PR to fix this! Note that there was an attempt to resolve the problem in #55135, but it was rejected. So maybe try a different approach? |
I think the middleware needs to be applied correctly. I'll put it like this: |
Laravel Version
11.44.2
PHP Version
8.3
Database Driver & Version
No response
Description
Attaching
Authorization
middleware does not work for route groups usingcan()
method, only viamiddleware('can...')
.This does not work:
Working example:
Steps To Reproduce
The text was updated successfully, but these errors were encountered: