shopping cart implementation in php
laravel 7
mysql
Before run the API sure that:
you're database is mysql
The service is running on port 3306
You have already a schema called cartproject
If it is the first time using this program use the following command to migrate the database:
php artisan migrate:fresh
After, you can use the following command to generate some data:
php artisan db:seed
Finally, Execute the API in the following way:
php artisan serve --port:3000
Please use port 3000 in order to use with the front-end project
Into the file tests/ you can find some request tests
status: enum('pending','completed')
name: string
sku: string
description: string
price: float
imageUrl: string
quantity: integer
product_id: integer
cart_id: integer
GET|HEAD api/carts
POST api/carts
GET|HEAD api/carts/{cart_id}
PUT|PATCH api/carts/{cart_id}
DELETE api/carts/{cart_id}
GET|HEAD api/products
POST api/products
GET|HEAD api/products/{product_id}
PUT|PATCH api/products/{product_id}
DELETE api/products/{product_id}
GET|HEAD api/product_cars
POST api/product_cars
GET|HEAD api/product_cars/{product_car_id}
PUT|PATCH api/product_cars/{product_car_id} // sending 0 as quantity in the request result in a delete from the database
DELETE api/product_cars/{product_car_id}