Skip to content

Commit

Permalink
Conventions table changed
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeymezenin committed Nov 23, 2017
1 parent 63547a7 commit 233261c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,31 +438,31 @@ DB | MySQL, PostgreSQL, SQLite, SQL Server | MongoDB

Also, follow naming conventions accepted by Laravel community:

How | Good | Bad
------------ | ------------- | -------------
Controller: singular | ArticleController | ~~ArticlesController~~
Route: plural | articles/1 | ~~article/1~~
Named route | 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 | article_user | ~~user_article, articles_users~~
Table column | meta_title | ~~MetaTitle; article_meta_title~~
Foreign key: singular model name with _id suffix | article_id | ~~ArticleId, id_article, articles_id~~
Primary key | id | ~~custom_id~~
Migration | 2017_01_01_000000_create_articles_table | ~~2017_01_01_000000_articles~~
Method | getAll | ~~get_all~~
Method in resource controller ([table](https://laravel.com/docs/master/controllers#resource-controllers)) | store | ~~saveArticle~~
Method in test class | testGuestCannotSeeArticle | ~~test_guest_cannot_see_article~~
Variable | $articlesWithAuthor | ~~$articles_with_author~~
Collection: descriptive, plural | $activeUsers = User::active()->get() | ~~$active, $data~~
Object: descriptive, singular | $activeUser = User::active()->first() | ~~$users, $obj~~
Config and language files index | articles_enabled | ~~ArticlesEnabled; articles-enabled~~
View | show_filtered.blade.php | ~~showFiltered.blade.php, show-filtered.blade.php~~
Config | google_calendar.php | ~~googleCalendar.php, google-calendar.php~~
Contract (interface): adjective or noun | Authenticatable | ~~AuthenticationInterface, IAuthentication~~
Trait: adjective | Notifiable | ~~NotificationTrait~~
What | How | Good | Bad
------------ | ------------- | ------------- | -------------
Controller | singular | ArticleController | ~~ArticlesController~~
Route | plural | articles/1 | ~~article/1~~
Named route | - | 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 alphabet order | article_user | ~~user_article, articles_users~~
Table column | - | meta_title | ~~MetaTitle; article_meta_title~~
Foreign key | singular model name with _id suffix | article_id | ~~ArticleId, id_article, articles_id~~
Primary key | - | id | ~~custom_id~~
Migration | - | 2017_01_01_000000_create_articles_table | ~~2017_01_01_000000_articles~~
Method | - | getAll | ~~get_all~~
Method in resource controller | [table](https://laravel.com/docs/master/controllers#resource-controllers) | store | ~~saveArticle~~
Method in test class | camelCase | testGuestCannotSeeArticle | ~~test_guest_cannot_see_article~~
Variable | camelCase | $articlesWithAuthor | ~~$articles_with_author~~
Collection | descriptive, plural | $activeUsers = User::active()->get() | ~~$active, $data~~
Object | descriptive, singular | $activeUser = User::active()->first() | ~~$users, $obj~~
Config and language files index | snake_case | articles_enabled | ~~ArticlesEnabled; articles-enabled~~
View | snake_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~~

[🔝 Back to contents](#contents)

Expand Down
8 changes: 4 additions & 4 deletions russian.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,13 @@ Pivot таблица | имена моделей в алфавитном пор
Миграция | - | 2017_01_01_000000_create_articles_table | ~~2017_01_01_000000_articles~~
Метод | - | getAll | ~~get_all~~
Метод в контроллере ресурсов | [таблица](https://laravel.com/docs/master/controllers#resource-controllers) | store | ~~saveArticle~~
Метод в тесте | - | testGuestCannotSeeArticle | ~~test_guest_cannot_see_article~~
Переменные | - | $articlesWithAuthor | ~~$articles_with_author~~
Метод в тесте | camelCase | testGuestCannotSeeArticle | ~~test_guest_cannot_see_article~~
Переменные | camelCase | $articlesWithAuthor | ~~$articles_with_author~~
Коллекция | описательное, мн. ч. | $activeUsers = User::active()->get() | ~~$active, $data~~
Объект | описательное, ед. ч. | $activeUser = User::active()->first() | ~~$users, $obj~~
Индексы в конфиге и языковых файлах | - | articles_enabled | ~~ArticlesEnabled; articles-enabled~~
Представление | - | show_filtered.blade.php | ~~showFiltered.blade.php, show-filtered.blade.php~~
Конфигурационный файл | - | google_calendar.php | ~~googleCalendar.php, google-calendar.php~~
Представление | snake_case | show_filtered.blade.php | ~~showFiltered.blade.php, show-filtered.blade.php~~
Конфигурационный файл | snake_case | google_calendar.php | ~~googleCalendar.php, google-calendar.php~~
Контракт (интерфейс) | прилагательное или существительное | Authenticatable | ~~AuthenticationInterface, IAuthentication~~
Трейт | прилагательное | Notifiable | ~~NotificationTrait~~

Expand Down

0 comments on commit 233261c

Please sign in to comment.