Clone the repo
git clone https://github.com/NowoDev/inv_manager.git
Navigate into the folder inv_manager
Run the migrations and seed the database
php artisan migrate --seed
Serve the project locally
php artisan serve
[POST] Register: /api/register
[POST] Login: /api/login
The registration endpoint accepts 5 values:
name, // string
email, // email
password, // var_char
confirm_password, // var_char
role // 'Admin' or 'Guest'
The login endpoint accepts 2 values:
email,
password
Upon Registration or Login, a JWT is generated and this can be used in Postman to test each inventory endpoint
[POST] Create: /api/inventory
[GET] Fetch/Read All Inventory: /api/inventory
[GET] Fetch/Read Single Inventory: /api/inventory/{id}
[PUT] Update Inventory: /api/inventory/{id}?name=$name&price=$price&quantity=$quantity
[DEL] Delete Inventory: /api/inventory/{id}
The CREATE
, and UPDATE
endpoints accept 3 values:
name, // string
price, // integer
quantity, // integer
Only the Admin
can CREATE
, READ/VIEW
, EDIT/UPDATE
, and DELETE
an inventory while Guests
can only READ/VIEW
an inventory.
[POST] Add Item to Cart /api/cart/{inventory_id}
The Cart endpoint also accepts 3 values:
user_id, // string
inventory_id, // integer
quantity, // integer
The user_id
is gotten from the authenticated user while the inventory_id
is gotten from the url. Thus, the quantity
is the only required value. When an item is added to the cart, the new quantity of that item is updated in the
inventory.
This project is also hosted on heroku and the endpoints can be tested in postman