From the course: Advanced Laravel

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Implement eager loading

Implement eager loading - Laravel Tutorial

From the course: Advanced Laravel

Implement eager loading

- [Instructor] Now in this book route, we want our members to choose from the list of scheduled classes and book a class. So let's implement that in our booking controller's create method. Booking controller, public function, create, get all the scheduled classes. Scheduled classes equals scheduled class and we want only the upcoming ones so where date time is greater than now. Let's also order them by oldest first and get. Now return the view, return view members dot book where to create this with scheduled classes, scheduled classes. Okay. Okay, function, yeah. Now create the view. Go to resources, views, member, new file, book dot blade dot php. Let's copy contents from the dashboard. Paste it here, change the title to book a class. And this view down here we can copy it from our instructor's upcoming view. So, let me copy everything from here until here. Paste it. Yeah…

Contents