mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-01-25 13:29:24 -06:00
3.0 KiB
3.0 KiB
Contributing
Contributions are welcome.
We accept contributions via Pull Requests on Github.
Pull Requests
- Check the code style with
$ composer check-styleand fix it with$ composer fix-style.
Follow Laravel naming conventions
| What | How | Good | Bad |
|---|---|---|---|
| Controller | singular | ArticleController | |
| Route | plural | articles/1 | |
| Named route | snake_case with dot notation | users.show_active | |
| Model | singular | User | |
| hasOne or belongsTo relationship | singular | articleComment | |
| All other relationships | plural | articleComments | |
| Table | plural | article_comments | |
| Pivot table | singular model names in alphabetical order | article_user | |
| Table column | snake_case without model name | meta_title | |
| Foreign key | singular model name with _id suffix | article_id | |
| Primary key | - | id | |
| Migration | - | 2017_01_01_000000_create_articles_table | |
| Method | camelCase | getAll | |
| Method in resource controller | table | store | |
| Method in test class | camelCase | testGuestCannotSeeArticle | |
| Variable | camelCase | $articlesWithAuthor | |
| Collection | descriptive, plural | $activeUsers = User::active()->get() | |
| Object | descriptive, singular | $activeUser = User::active()->first() | |
| Config and language files index | snake_case | articles_enabled | |
| View | snake_case | show_filtered.blade.php | |
| Config | snake_case | google_calendar.php | |
| Contract (interface) | adjective or noun | Authenticatable | |
| Trait | adjective | Notifiable |
-
Document any change in behaviour - Make sure the
README.mdand any other relevant documentation are kept up-to-date. -
Create feature branches - Don't ask us to pull from your master branch.
-
One pull request per feature - If you want to do more than one thing, send multiple pull requests.
-
Use Laravel helpers when possible and not facades - auth(), info(), cache(), response(), ext. Laravel Helpers
Happy coding!