课程: Advanced Laravel
今天就学习课程吧!
今天就开通帐号,24,100 门业界名师课程任您挑!
Revisit CRUD basics
- [Instructor] Now it's time to add the functionality for instructors to schedule classes, view the upcoming ones, and cancel them if needed. Let's create a resource controller for the same, sail artisan make:controller ScheduledClassController --resource. The controller is created. Next, let's register the resource routes in web.php. So let's do that down here. Route::resource, and here we can call it /instructor/schedule. Schedule classes will be too long. So let's just minimize that to schedule. And now we just have to point this to the ScheduledClassController. And we don't need all the resource routes like edit and update. They're not needed. So chain this with the only method. And we would need the index action to list all the classes. We need the create and store methods to create a class and save them. And finally, we need the destroy method to cancel a class. And of course, don't forget to chain this with…