Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Now that we’ve covered Routing, Controllers, and Views, let’s talk about the final element: Models. Models are the direct connection between a database and the Laravel application. In a perfect world, Models will directly mirror the structure of your database. That is to say, each database table corresponds to a model-- the user model interacts with the user table, and so on. Let’s look at how we can connect our Laravel application to the database.
A migration class contains two methods: up and down. In Laravel, the up()
function will run when you use the php artisan migrate
command and the down()
function will run when you use the php artisan migrate:rollback
command.
Learn more about: running Migrations
LINKS:
You need to sign up for Treehouse in order to download course files.
Sign up