laravel - Laravel spatie/laravel-permissions Naming Conventions
问题描述
Are there some naming guidelines I should be following when it comes to naming permissions? Right now, everything I find is just along the lines of "Add Foo","Edit Foo","Delete Foo","Add FooBar","Edit FooBar","Delete FooBar", and so forth and so forth.
Keeping in mind that there is no grouping (which is a real pity), and when you have a management screen for all said permissions - the above approach seems quite sloppy.
All your "adds" are together, "edits" are together, etc. eg:
- Add Foo
- Add FooBar
- Add FooBarBez
- Edit Foo
- Edit FooBar
- Edit FooBarBez
- Delete Foo
- Delete FooBar
- Delete FooBarBez
Right now I'm leaning towards something along the lines of what route names look like, for example:
- foo.add
- foo.edit
- foo.delete
- foobar.add
- foobar.edit
- foobar.delete
- foobarbez.add
- foobarbez.edit
- foobarbez.delete
It's more organised in terms of keeping all the 'parent' permissions together (ie: all Foo's together, all FooBar's together, etc). Of course, if there are actual guidelines for this, please do let me know or if you have other valuable input / suggestions?
//Edit Update for Clarity
Specifically,
- __Are__ any naming conventions?
- Are there any preferences in terms of use of singular/plural when it comes to parents (eg: "User Create", "Users Create")
- If parents and action should be separated with a space, a dot, something else? (eg: "users.create"; "users create"; "users->create")
- What about nested resources (Parent.Child)? eg: "users.banking_details.create"
- Captilisation? Lowercase? Camel Case?
As mentioned previously, leaning towards laravel named routes as the guideline so would be: plural, lowercase, separated by dots, including full path (parent+child relationship). Just because thats what I'm leaning towards, doesnt mean its right though, hence me asking for input from the community :)
解决方案
推荐阅读
- android-emulator - Genymotion 与 Virtualbox 完全卸载并回收硬盘空间
- mongodb - 如何在 MongoDB 项目期间遍历字段的值?
- javascript - 通过ajax请求获取react app并执行
- ios - 仅在调试配置模式下,iOS 应用程序在启动屏幕后关闭/崩溃
- ruby - 有条件地使规范待定
- node.js - 如何从剧作家那里读取文本框值
- android - android 10 BitmapFactory.decodeFile(ImageFilePath) 返回 null
- r - 下载 zip 文件并在 Shiny App 中提取特定文件
- javascript - AnyChart 股票图表 - X 轴上的日期扩展溢出
- python - 如何修复 TypeError:只能将 str(不是“字节”)连接到 str?