BestDivision Logo

Laravel Naming Conventions

BestDivision
BestDivision  @bestdivision
Created At - 2022-06-29
Last Updated - 2024-08-28

Table of Contents

  • Laravel Naming Conventions
    • Table Names:
    • Column Names should be singular:
    • Controllers Name should be singular Pascal Camel Case ( Upper Camel Case):
    • Models should be singular Pascal Camel Case

Laravel Naming Conventions

Table Names:

users, blogs, comments ( Entity )

user_blog, user_comment ( Relationship )

Column Names should be singular:

id, user_id, post_id 

Note:

  • Primary Key should be used simply as id. You can follow tablename_id also. But I personally prefer simply id.
  • Foreign Key should follow tablename_id. E.g. user_id, post_id.

Controllers Name should be singular Pascal Camel Case ( Upper Camel Case):

BlogController, UserController

Models should be singular Pascal Camel Case

User, Blog

Share

‌

  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌