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 命名约定


基础教程推荐
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 使用 PDO 转义列名 2021-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- HTTP 与 FTP 上传 2021-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01