mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Replace product by restaurant in the controller documentation
This commit is contained in:
parent
8b688cfbcf
commit
4be0566ad7
@ -12,7 +12,7 @@ Here are the core methods (and their current implementation).
|
||||
You can simply copy and paste this code in your own controller file to customize the methods.
|
||||
|
||||
::: warning
|
||||
In the following example we will consider your controller, service and model is named `product`
|
||||
In the following example we will consider your controller, service and model is named `restaurant`
|
||||
:::
|
||||
|
||||
#### `find`
|
||||
@ -27,9 +27,9 @@ module.exports = {
|
||||
|
||||
find(ctx) {
|
||||
if (ctx.query._q) {
|
||||
return strapi.services.product.search(ctx.query);
|
||||
return strapi.services.restaurant.search(ctx.query);
|
||||
}
|
||||
return strapi.services.product.find(ctx.query);
|
||||
return strapi.services.restaurant.find(ctx.query);
|
||||
},
|
||||
};
|
||||
```
|
||||
@ -45,7 +45,7 @@ module.exports = {
|
||||
*/
|
||||
|
||||
findOne(ctx) {
|
||||
return strapi.services.product.findOne(ctx.params);
|
||||
return strapi.services.restaurant.findOne(ctx.params);
|
||||
},
|
||||
};
|
||||
```
|
||||
@ -62,9 +62,9 @@ module.exports = {
|
||||
|
||||
count(ctx) {
|
||||
if (ctx.query._q) {
|
||||
return strapi.services.product.countSearch(ctx.query);
|
||||
return strapi.services.restaurant.countSearch(ctx.query);
|
||||
}
|
||||
return strapi.services.product.count(ctx.query);
|
||||
return strapi.services.restaurant.count(ctx.query);
|
||||
},
|
||||
};
|
||||
```
|
||||
@ -124,7 +124,7 @@ module.exports = {
|
||||
*/
|
||||
|
||||
delete(ctx) {
|
||||
return strapi.services.product.delete(ctx.params);
|
||||
return strapi.services.restaurant.delete(ctx.params);
|
||||
},
|
||||
};
|
||||
```
|
||||
@ -137,7 +137,7 @@ You can also create custom controllers to build your own business logic and API
|
||||
|
||||
There are two ways to create a controller:
|
||||
|
||||
- Using the CLI `strapi generate:controller product`. Read the [CLI documentation](../cli/CLI.md#strapi-generatecontroller) for more information.
|
||||
- Using the CLI `strapi generate:controller restaurant`. Read the [CLI documentation](../cli/CLI.md#strapi-generatecontroller) for more information.
|
||||
- Manually create a JavaScript file in `./api/**/controllers`.
|
||||
|
||||
### Adding Endpoints
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user