From the course: Advanced Laravel

Unlock the full course today

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

Revisit CRUD basics

Revisit CRUD basics - Laravel Tutorial

From the course: Advanced Laravel

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…

Contents