https://github.com/zetaret/laravel-example2
Laravel Example 2
https://github.com/zetaret/laravel-example2
api blade eloquent-orm laravel migration mysql postman seed
Last synced: 12 months ago
JSON representation
Laravel Example 2
- Host: GitHub
- URL: https://github.com/zetaret/laravel-example2
- Owner: ZetaRet
- Created: 2024-10-29T14:46:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-11T13:23:41.000Z (over 1 year ago)
- Last Synced: 2025-02-12T22:27:37.232Z (about 1 year ago)
- Topics: api, blade, eloquent-orm, laravel, migration, mysql, postman, seed
- Language: PHP
- Homepage:
- Size: 120 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Setup
Read the `setup.md` of [`laravel-example1`](https://github.com/ZetaRet/laravel-example1) and choose the steps missing on your computer to finalize the install.
## Main Page
`Basket` describes steps to use Postman API.
## Postman
__get products:__ GET request to list all products from database
__get csrf:__ GET request to save in collection variables the form token, needed for POST requests
__get basket:__ GET request to retrieve current items in the basket and user wallet
__increment basket:__ POST request to set product in the basket plus 1, checks wallet total
__decrement basket:__ POST request to set product in the basket minus 1
__clear basket:__ POST request to clear the basket
__update basket:__ POST request to set products in the basket, real quantity is invisible on this step, checks wallet total, deletes previous basket
__purchase basket:__ POST request to sum transaction query and set the user purchase from the basket, checks all baskets to ensure 1 quantity left per user and manages maximum per product using stored total (per user max is 5), clears the basket
## Models
`User` model is extended to support virtual wallet. New model `Product` with table is created.
## Seeding
Seeding the database using `php artisan db:seed --class=UserSeeder` for 3 records. Change the class to `ProductSeeder` to generate 2 products or type `php artisan db:seed --class=UserProductsReset` to reset user wallet to 100 and initial products count.