Tabela para consulta rápida a convenção de nomes utilizadas em projetos Laravel:
O que
Como
Bom
Ruim
Controller
singular
ArticleController
ArticlesController
Route
plural
articles/1
article/1
Named route
snake_case with dot notation
users.show_active
users.show-active, show-active-users
Model
singular
User
Users
hasOne or belongsTo relationship
singular
articleComment
articleComments, article_comment
All other relationships
plural
articleComments
articleComment, article_comments
Table
plural
article_comments
article_comment, articleComments
Pivot table
singular model names in alphabetical order
article_user
user_article, articles_users
Colunas em tabelas
snake_case without model name
meta_title
MetaTitle; article_meta_title
Model property
snake_case
$model->created_at
$model->createdAt
Foreign key
singular model name with _id suffix
article_id
ArticleId, id_article, articles_id
Chaves primárias
-
id
custom_id
Migrações
-
2017_01_01_000000_create_articles_table
2017_01_01_000000_articles
Métodos
camelCase
getAll
get_all
Métodos em controllers
table
store
saveArticle
Métodos e classes de teste
camelCase
testGuestCannotSeeArticle
test_guest_cannot_see_article
Variáveis
camelCase
$articlesWithAuthor
$articles_with_author
Collection
descriptive, plural
$activeUsers = User::active()->get()
$active, $data
Object
descriptive, singular
$activeUser = User::active()->first()
$users, $obj
Config e arquivos de linguagem
snake_case
articles_enabled
ArticlesEnabled; articles-enabled
View
kebab-case
show-filtered.blade.php
showFiltered.blade.php, show_filtered.blade.php
Config
snake_case
google_calendar.php
googleCalendar.php, google-calendar.php
Contract (interface)
adjective or noun
Authenticatable
AuthenticationInterface, IAuthentication
Trait
adjective
Notifiable
NotificationTrait
Fonte:
https://github.com/jonaselan/laravel-best-practices#siga-a-conven%C3%A7%C3%A3o-de-nomes-usada-no-laravel