Naming Conventions
Last updated
Last updated
მოცემულ ცხრილში აღწერილია ყველაზე მნიშვნელოვანი და ხშირად დაშვებული შეცდომები Naming Convention-ებთან დაკავშირებით.
Variable
descriptive
camelCase
$profilePicture
$img
Model
Singular
PascalCase
User
Users
Controller
Singular
PascalCase
PostController
PostsController, postController
method
descriptive
camelCase
updateTaskPosition
change, update_task_position
Route
Plural
kebab-case
active-users/1
active-user/1, activeUsers/1, active/users/1
Named route
resources. action
snake_case
users.show_active
users.show-active, show-active-users
Collection
descriptive, plural
camelCase
$users
$data, $user, $col
database table
Plural
snake_case
posts
post
Pivot table
Singular model names. in alphabetical order
snake_case
post_user
posts_users,
user_post
hasOne or belongsTo relationship
Singular
camelCase
author
authors
All other relationships
Plural
camelCase
comments
comment