Laravel 5 Naming Conventions

I am a little confused by the Laravel conventions as I am new to this structure. I follow the Jeffrey Laracasts Way video, it uses Pluralism for controller names.

For example: PagesController, Card Controller, PostsController

But if I relate the official documentation of Laravel> Controllers and Laravel> Tutorials> Quick Start> Interim Task List uses Singular names .

For example: PhotoController, TaskController

Can I comment on the official coding agreements for the following objects?

Tables: posts, comments, post_comments or Post, Comment, PostComment

Columns: id, post_id, comment_id or id, postId, commentId

Controllers: PagesController, Card Controller, PostsController or PhotoController, TaskController

Models: Pages, cards, messages or Page, Card, Message

+6
source share
3 answers

Tables: posts, comments, comment_post

Columns: id, post_id, comment_id

Controllers: PhotoController, TaskController

: , ,

Laravel.

+11

, "" - , , , , :

  • : _ (, ,...)
  • : single _ (, ,...)
  • : (User, Tag,... )
  • : , "" (UserController, TagController,...)
+2

, ( 1984 , PHP js/ECMAScript ), Merise " " . "" .

PSR-2 PSR-1 , , , "" ( "" ). . datatables, laravel, . ( , ), .

- (: "personnal" i.o. "personal" ..). Doublecheck. .

0

Source: https://habr.com/ru/post/1014093/


All Articles