# Show, Edit, Update & Delete
# Views
Views are stored in the resources/views directory
Go to resources/views
Create trainings folder, create
- show.blade.php
- edit.blade.php
# Controller
7 method in controllers
Make Controller
php artisan make:controller TrainingController
| Action |
|---|
| show |
| edit |
| update |
| destroy |
# Show
Controller - Show
| Description | URL | Controller Function | View File |
|---|---|---|---|
| Show one of the trainings | GET example.com/trainings/{id} | show() | app/views/trainings/show.blade.php |
Views - Show View
Views are stored in the resources/views directory
- Go to resources/views/trainings/show.blade.php
# Edit
Controller - Edit
| Description | URL | Controller Function | View File |
|---|---|---|---|
| Pull a training form the database and allow editing | GET example.com/trainings/{id}/edit | edit() | app/views/trainings/edit.blade.php |
View - Edit View
Views are stored in the resources/views directory
- Go to resources/views/trainings/edit.blade.php
# Update
Controller - Update
| Description | URL | Controller Function | View File |
|---|---|---|---|
| Process the create form submit and save the training to the database | POST example.com/trainings/{id} | update() | NONE |
# Delete
Controller - Destroy/Delete
| Description | URL | Controller Function | View File |
|---|---|---|---|
| Delete the training from DB | GET example.com/trainings/{id}/delete | delete() | NONE |