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.
我猜是这样的:
- 控制器是复数的
- 视图是复数的
- 模型是单一的
- Controllers are plural
- Views are plural
- Models are singular
我在正确的轨道上吗?
我了解这只是一个惯例,您没有要遵守它们,但我仍然想知道正确的方法是什么.
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混合使用.如果我有一个显示多个事物"的视图(例如,雇员列表),则该视图是复数的.如果我有一个显示单个Employee的视图,则它是单数.
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屋!