Eloquent conventions
Eloquent has some conventions, which, if followed, will make your life easier. This approach is known as convention over configuration, which means, if you follow these conventions, you will have to do very little configuration for things to "just work".
An Eloquent model is contained in a single class and is the "studly-cased", singular version of your database table's name. Studly-case is similar to camel-casing, but the first letter is uppercase as well. So if you have a database table called cats
, then your model class will be called Cat
.
There is no set place in the filesystem to place your Eloquent models; you are free to organize them as you see fit. You can use an Artisan command to create a model stub (a simple class with the basic structure of an Eloquent model). The command is:
$ php artisan app:model Cat
By default, Artisan places new model classes in the app
directory. You are free to move your model classes and store them in whatever directory you wish, just...