Title here
Summary here
A shop needs new inventory. Add product.create so staff can insert a row without opening a SQL console.
createAction with table('products')->save()product.listprotected function createAction(Arrayable $data): ApiResponse
{
$id = table('products')->save([
'name' => $data->get('name'),
'price' => $data->get('price'),
'stock' => $data->getInt('stock') ?? 0,
]);
return response(0, 'Product created', ['id' => $id]);
}curl -s -X POST http://127.0.0.1:8000/api/v1/ \
-H "Content-Type: application/json" \
-d '{"service":"product","action":"create","name":"Tote Bag","price":18.00,"stock":40}'Then product.list again — the tote should appear. Step 8 adds validation so empty names are rejected cleanly.
title instead of name — match your column namesgetInt when you expect an integer