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

查看:89
本文介绍了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,Cards Controller,PostsController

但是,如果我参考 Laravel>控制器 Laravel>教程>快速入门>中级任务列表,它使用单数名称.

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?

表格:帖子,评论,帖子评论帖子,评论,帖子评论

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

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