Create a Schema for Categories

Learn how to create schema models of categories for our e-commerce application.

Previously, we learned how to create a schema for our products (shoes). In this lesson, we are going to create a schema for our categories. The process is quite similar but has different fields.

Create a category model and add fields

Similar to how we created the model and added fields, we’ll do the same for the category model. The category model will have just three fields: name, slug, and image. The name field will be a single-line field, the slug field will be a slug field, and the image will be an asset picker field. In the end, our category model will look like this.

Get hands-on with 1200+ tech skills courses.