Laravel 5 命名约定 [英] Laravel 5 Naming Conventions

查看:37
本文介绍了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 > ControllersLaravel > 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_idid、postId、commentId

控制器:PagesController、卡片控制器、PostsControllerPhotoController、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 命名约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆