get all products from parent category and all it's sub-categories Adonis V5 #2019
Replies: 5 comments 6 replies
-
Also interested in this. I know with Laravel it goes like this (look at the accepted answer): I show this solution because I come from Laravel and would like to do this in Adonisjs (Am using V5)
|
Beta Was this translation helpful? Give feedback.
-
Hi, I am interested in recursive parent - child relationships also What I have now for typical ecommerce category model:
and in controller
but this solution only fetch root - children - children .... ideally we want to fetch all levels of children recursively |
Beta Was this translation helpful? Give feedback.
-
I have a working solution for this. Planning to create a polished example and blog about it this week. |
Beta Was this translation helpful? Give feedback.
-
import { DateTime } from 'luxon' export default class Post extends BaseModel { @column() @column() @column() @column.dateTime({ autoCreate: true }) @column.dateTime({ autoCreate: true, autoUpdate: true }) |
Beta Was this translation helpful? Give feedback.
-
Do we have a solution to this yet? I have tried to research and I am unable to find it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Here's my categories table :
and here's my products-category Pivot table :
How can i setup my category model and product model -> recursive model
to get product with its assigned categories and subCategories (childs) ?
Beta Was this translation helpful? Give feedback.
All reactions