composer install
php artisan passport:install
php artisan migrate:fresh --seed
I am using Laravel Passport for the authentication.
- Grab an auth token by sending a POST request to /api/auth/token with the following:
- password
- Add the returned token to the Authorization header when making an API request.
Authorization: Bearer {token}
Index - GET request to /api/products
Show - GET request to /api/products/{productId}
Store - POST request to /api/products with the following:
- name (string)
- description (text)
- price (decimal)
Update - PATCH request to /api/products/{productId} with any of the following:
- name (string)
- description (text)
- price (decimal)
Destroy - DELETE request to /api/products/{productId}
Store - POST request to /api/products/{productId}/image with the following:
- image (file)
List - GET request to /api/user-products
Attach - POST request to /api/user-products with the following:
- product_id
Detach - DELETE request to /api/user-products/{productId}