I'm using laravel eloquent data objects to access my data, what is the best way to name my tables, columns, foreign/primary keys etc?
I found, there are lots of naming conventions out there. I'm just wondering which one best suits for laravel eloquent models.
I'm thinking of following naming convention:
- Singular table names (ex: Post)
- Singular column names (ex: userId - user id in the post table)
- Camel casing for multiple words in table names (ex: PostComment, PostReview, PostPhoto)
- Camel casing for multiple words in column names (ex: firstName, postCategoryId, postPhotoId)
So with this, I could use similar syntax in the controller.
$result = Post::where('postCategoryId', '4')->get();
Are there any recommended Laravel guidelines for this? Can I proceed with these naming conventions?
If someone has better suggestions, I will be very happy to hear them.Thanks a lot!