Join Joseph Lowery for an in-depth discussion in this video Creating tables with Schema Builder, part of Learning Laravel 4.
Now that we know how to connect to a database in Laravel,…or at least you do if you watched the last lesson,…let's create a table within that database.…Of course, you could do this through phpMyAdmin…or your command line,…but you gain a tremendous amount of flexibility…by building your database structure programmatically.…Another term for database structure is schema,…and we're going to be applying Laravel's Schema Builder…to accomplish our task.…Let's get going.…You want to be able to make sure your database table…is created the first time anyone accesses your application.…
So Schema Builder functions go in the routes.php file.…Because I want the function to fire…whenever any page is requested,…I'll put my code in the top most general route…that starts on Line 14.…I'll create a little space above the return code…for my Schema Builder functions.…We're going to frame the entire code block…with a call to the schema class…followed by double colons,…and then the specific method create.…
Now within the parentheses there are two arguments.…
- Installing Laravel
- Handling testing
- Establishing an HTML view
- Connecting to a database
- Enabling version control
- Setting up-and-running unit tests
Skill Level Intermediate
1. Introduction to Laravel
2. Creating Initial Laravel Pages
3. Displaying Laravel Code
4. Creating a Laravel Application
5. Testing Your Laravel Code
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.