控制器/模型/视图的 Laravel 命名约定是什么? [英] What are the Laravel naming conventions for controllers/models/views?
问题描述
我记得听说你应该以一种特殊的方式命名你的控制器、模型和视图.无论是单数还是复数.我不记得要命名哪些内容,而且我在文档中找不到任何相关内容.
I remember hearing you should name your controllers, models and views in a special way. Either singular or plural. I don't remember which ones to name what though, and i can't find anything about it in the doc.
我猜是这样的:
- 控制器是复数
- 视图是复数
- 模型是单一的
我在正确的轨道上吗?
我知道这只是一个约定,您不必遵循它们,但我仍然想知道正确的方法是什么.
I understand it's just a convention and you don't have to follow them, but i still want to know what the right way is.
推荐答案
在 ASP.NET MVC 中,我使用你上面提到的约定,除了 Views,它们是混合的.如果我有一个显示多个事物"的视图,例如员工列表,则它是复数形式.如果我有一个显示单个员工的视图,它是单数.
In ASP.NET MVC, I use the convention you mentioned above, expect for Views, which are mixed. If I have a view that displays multiple "things", such as a list of Employees, it is plural. If I have a view that displays a single Employee, it is singular.
这篇关于控制器/模型/视图的 Laravel 命名约定是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!