Web programming 2 - TP-1
Web programming 2 - TP-1
LARAVEL - INSTALLATION
I. Install any web server having Apache and Mysql
Wamp, Xampp, EasyPhp, etc.
II. Install composer :
Laravel uses composer to manage dependencies
https://getcomposer.org/download/
2
LARAVEL - INSTALLATION
III. Install Laravel :
Go to your web server root folder
Run the command to create your first Laravel project
4
EXERCISE 1- SIGNUP
Step 1:
Create the HTML form
Step 2:
Create corresponding route: localhost:8000/Signup
Step 3:
Create user controller
When user clicks the Register button, we need to
display a message
‘Welcome Firstname, Lastname’ 5
EXERCISE 1- SIGNUP
Step 4:
Set database connection string
Create user Model and DB table
Add needed methods ( for CRUD operations)
Step 5:
Set the Signup logic:
Verify email is not already taken
Encrypt password before adding the record to the DB
Display a message to the user 6
EXERCISE 2- GET ALL USERS
Step1:
We need to display the list of users we added in
exercise 1 following the below grid.
7
EXERCISE 2- GET ALL USERS
Step 2:
Add to the above grid , a simple search.
User can search by
Name
Email
8
EXERCISE 2- GET ALL USERS
Step 3:
When user clicks on a record, he will be redirected
to the user details page.
9
EXERCISE 2- GET ALL USERS
Step 4:
When user clicks on edit, he will be redirected to
the below screen to update his info.
When user clicks on delete, show a confirmation
popup before deleting the intended user.
10
EXERCISE 3- MOVIE APPLICATION
We need to build a movie review application using
Laravel where users can:
browse through list of movies
11
EXERCISE 3- MOVIE APPLICATION
In this web app, we support two roles:
Admin can:
Add/ update/ delete movies
Delete reviews
User can :
Browse and search for movies
14
Get request with movie Id
EXERCISE 3- MOVIE APPLICATION
Add review page
The page has a:
title
rating : 1 to 5
content
Post request
15
EXERCISE 3- MOVIE APPLICATION
Search page
User can by search movie title
or description
Results will be displayed as
per the image here
16
EXERCISE 4- RESTFUL WEB API
The purpose of the exercise is to create a small
restful API that will get, add, update and delete
students.
5. DELETE /api/students/{id}
• will delete a student record by referencing its id and will be
accepting DELETE requests.
• Call the get service to validate that the record was deleted 19
EXERCISE 4- RESTFUL WEB API
General notes:
Routes should be set in routes/api.php
All responses should be of type json
For Post and Put services, the request should be of type json
Make sure to return the correct response code:
200 ok
404 not found
500 internal sever error
etc.
20