Skip to content

Commit

Permalink
Merge pull request laravel#6372 from markjaquith/issue/provide-lowerc…
Browse files Browse the repository at this point in the history
…ase-snake-case-table-name-example

[8.x] Provide an example of multi-word model-to-table mapping
  • Loading branch information
taylorotwell committed Sep 15, 2020
2 parents 4488170 + c6030e5 commit e7c4935
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion eloquent.md
Expand Up @@ -68,7 +68,9 @@ Now, let's look at an example `Flight` model, which we will use to retrieve and

#### Table Names

Note that we did not tell Eloquent which table to use for our `Flight` model. By convention, the "snake case", plural name of the class will be used as the table name unless another name is explicitly specified. So, in this case, Eloquent will assume the `Flight` model stores records in the `flights` table. You may specify a custom table by defining a `table` property on your model:
Note that we did not tell Eloquent which table to use for our `Flight` model. By convention, the "snake case", plural name of the class will be used as the table name unless another name is explicitly specified. So, in this case, Eloquent will assume the `Flight` model stores records in the `flights` table, while an `AirTrafficController` model would store records in an `air_traffic_controllers` table.

You can manually specify a table name by defining a `table` property on your model:

<?php

Expand Down

0 comments on commit e7c4935

Please sign in to comment.