Skip to content
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

支持去除多层控制器默认前缀 #2599

Open
wants to merge 1 commit into
base: 6.0
Choose a base branch
from

Conversation

9007967
Copy link
Contributor

@9007967 9007967 commented Oct 6, 2021

多层控制器通过controller获取的时候会出现
name.controller
这种问题,利用多层控制器做api版本切换的时候权限表记录的都是 应用名+控制器名+方法名(api::common::sendSms)
实际获取的话会出现 api::v1.common::sendSms
每次切换api版本的时候 都要批量修改权限表路由字段 更换v1为v2
为了更方便的使用 在特定场景直接 获取到api::common::sendSms来匹配用户是否有权限 不受版本号影响

用法:
PHP<8
$request->controller(true,true);
PHP>=8
$request->controller(prefix:true);
第一个true是将控制器转换为小写
第二个true是去除前缀

多层控制器通过controller获取的时候会出现
name.controller
这种问题,利用多层控制器做api版本切换的时候权限表记录的都是 应用名+控制器名+方法名(api::common::sendSms)
实际获取的话会出现 api::v1.common::sendSms
每次切换api版本的时候 都要批量修改权限表路由字段 更换v1为v2
为了更方便的使用 在特定场景直接 获取到api::common::sendSms来匹配用户是否有权限 不受版本号影响


用法:
PHP<8
$request->controller(true,true);
PHP>=8
$request->controller(prefix:true);
第一个true是将控制器转换为小写
第二个true是去除前缀
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.

None yet

1 participant