Search code examples
laravelmodels

Model and table name conventions Laravel


I want to know model and table conventions in Laravel.

I have table users and user_address now I do not want to use

protected $table = "user_address"

property. Please suggest me the right convention in model or table.


Solution

  • If the name of the model is UserAddress, the name of the table should be plural. So it will be user_addresses.

    Read more about Laravel naming conventions here.