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 命名约定
基础教程推荐
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何替换eregi() 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
