Product and category management, a product can belong to a category and the category can have hierarchical structure.
Faker : php artisan db:seed
{
"data": [
{
"id": 2,
"name": "fruits",
"product": {
"data": [
{
"id": 25,
"name": "Banana",
"image": "banana-2019085304.jpg",
"category_id": 2,
"created_at": "2019-12-11T08:34:07.000000Z"
},
{
"id": 26,
"name": "Grape",
"image": "grape-2019114258.jpg",
"category_id": 2,
"created_at": "2019-12-11T11:42:59.000000Z"
}
]
}
}
]
}
Method | Route | Parameter | Notes |
---|---|---|---|
GET |
api/v1/category |
List all resource | |
GET |
api/v1/category/:id |
id |
|
POST |
api/v1/category |
name |
|
PUT/PATCH |
api/v1/category/:id |
id |
|
DELETE |
api/v1/category/:id |
id |
Method | Route | Parameter | Notes |
---|---|---|---|
GET |
api/v1/product |
||
GET |
api/v1/product/:id |
id |
|
POST |
api/v1/product |
name , image |
|
PUT/PATCH |
api/v1/product/:id |
id |
|
DELETE |
api/v1/product/:id |
id |