Laravel命名規則
| 型態 | 規則 | 範例 |
|---|---|---|
| Route | 複數 | articles/1 |
| Route Name | 帶點符號的蛇形命名 | article.index |
| Controller | 單數 | ArticleController |
| Model | 單數 | Article |
| Service | 單數 | ArticleService |
| Repository | 單數 | ArticleRepository |
| hasOne or belongsTo relationship | 單數 | articleComment |
| All other relationships | 複數 | articleComments |
| Method | 小駝峰命名 | getAll |
| Trait | 形容詞 | Exportable |
| View | 蛇形命名 | list.blade.php |
| Config | 蛇形命名 | article.php |
| Variable | 小駝峰命名 | $articleName |
| Migration | - | 2020_01_01_000000_create_articles_table |
| Table | 複數 | articles |
| Primary key | - | id |
| Foreign key | 單數名稱_id | article_id |
| Table column | 蛇形命名 | article_click |
留言