Eloquent Models and Migrations
Generate models and database migrations with Artisan commands.
What is Eloquent?
Eloquent is Laravel' ActiveRecord ORM. Each database table has a corresponding Model class that represents a row and provides query methods.
Generating a Model
Use Artisan to create a model. Add -m to also generate a migration file.
$ php artisan make:model Post -m
# Creates:
# app/Models/Post.php
# database/migrations/xxxx_create_posts_table.phpAll lessons in this course
- Eloquent Models and Migrations
- CRUD with Eloquent
- Eloquent Relationships
- Eager Loading and Query Scopes