Laravel 5 Naming Conventions(Laravel 5 命名约定)
问题描述
我对 Laravel 约定有点困惑,因为我是这个框架的新手.我正在关注 Jeffrey Way Laracasts 视频,他使用 复数 作为控制器名称.
I am bit confused with Laravel conventions as I am new to this framework. I am following Jeffrey Way Laracasts videos he uses Plural for Controller names.
例如:PagesController、卡片控制器、PostsController
但是如果我参考 Laravel > Controllers 和 Laravel > Tutorials > Quick Start > Intermediate Task List 它使用Singular 名字.
But if I refer official documentations of Laravel > Controllers and Laravel > Tutorials > Quick Start > Intermediate Task List it uses Singular names.
例如:PhotoController、TaskController
有人可以列出以下实体的官方编码约定吗?
Can anybody please list down the official coding conventions for following entities?
表格:帖子、评论、post_comments 或帖子、评论、帖子评论
列:id、post_id、comment_id 或 id、postId、commentId
控制器:PagesController、卡片控制器、PostsController 或 PhotoController、TaskController
模型:页面、卡片、帖子或页面、卡片、帖子
推荐答案
表格: 帖子、评论、comment_post
Tables: posts, comments, comment_post
列:id、post_id、comment_id
Columns: id, post_id, comment_id
控制器: PhotoController、TaskController
Controllers: PhotoController, TaskController
模型:页面、卡片、帖子
有关更多详细信息,请查看我的 Laravel 命名约定 表.
For more details check out my Laravel naming conventions table.
这篇关于Laravel 5 命名约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Laravel 5 命名约定


基础教程推荐
- Web 服务器如何处理请求? 2021-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- php中的foreach复选框POST 2021-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- php中的PDF导出 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01