# Show, Edit, Update & Delete

# Views

Views are stored in the resources/views directory

  1. Go to resources/views

  2. Create trainings folder, create

    1. show.blade.php
    2. edit.blade.php

Crud

# Controller

7 method in controllers

Make Controller

php artisan make:controller TrainingController
Action
index
create
store
show
edit
update
destroy

# Show

Controller - Show

DescriptionURLController FunctionView File
Show one of the trainingsGET example.com/trainings/{id}show()app/views/trainings/show.blade.php

Crud

Views - Show View

Views are stored in the resources/views directory

  1. Go to resources/views/trainings/show.blade.php

Crud

# Edit

Controller - Edit

DescriptionURLController FunctionView File
Pull a training form the database and allow editingGET example.com/trainings/{id}/editedit()app/views/trainings/edit.blade.php

Crud

View - Edit View

Views are stored in the resources/views directory

  1. Go to resources/views/trainings/edit.blade.php

Crud

# Update

Controller - Update

DescriptionURLController FunctionView File
Process the create form submit and save the training to the databasePOST example.com/trainings/{id}update()NONE

Crud

# Delete

Controller - Destroy/Delete

DescriptionURLController FunctionView File
Delete the training from DBGET example.com/trainings/{id}/deletedelete()NONE

Crud