Hello I have two models Category and Product. The Category model has a table structure like so: "id, name" and the Product have: "id, name, category_id"
When I return all the products, I would like the category_id field replaced by the corresonding "name" value from the "categories" table.
Example:
Categories:
id name
1 cloth
2 food
Products:
id name category_id
1 carrot 2
2 pants 1
3 shirt 1
Result
id name category_id
1 carrot food
2 pants cloth
3 shirt cloth