课程: Advanced Laravel
今天就学习课程吧!
今天就开通帐号,24,100 门业界名师课程任您挑!
Create the database and models
- [Instructor] Now let's start thinking about our database tables and models. We already have our user table ready. Let's think of the next table to create. The first feature of our app is for instructors to be able to schedule classes. That means we need to have a scheduled classes table. This will be associated with the schedule class model, so a schedule class can be created, viewed or deleted, if you think of it that way. This table will have an ID as a primary key and a column for the type of class like yoga, Pilates, dance fitness, and so on, and then one for the date and time of the class. This could be our date/time. We also need a column for the instructor. Now this instructor will actually be one of our users, so instructor can be a foreign key. We can say instructor ID, which is a foreign key that references the user's ID. And let me pull this down here and this is a one-to-many relationship that is one…