I have two models:
Course that can have many Lesson.
I want to be able to order the Lessons inside a Course.
I tried to implement a SimpleTree Trait (I use the example of the Category in october/test/trees demo plugin)
I changed the parent_id for “course_id” but it doesn’t work. I’m probably missing something.
Quick view of the tables:
id | title | description
id | course_id | title | description | sort_order
Maybe it’s the wrong way to go. Can’t find many examples on that… if anyone can point out a direction, it would be appreciated !
The teacher should be able to manage the order of the lessons that the students will go through during the course.
I could try to implement a custom solution but if there is something out of the box that can apply, it would be better.
April 18, 2023, 5:10am
Simple Tree manages basic child-parent relationships. I think you may need the
Sortable trait for this…
According to the docs, Sortable Trait seems to be useful if you have a simple model (ex: User) and you want to order them AMONG them.
The things is I want to order records related to a parent category (in a relation driven by the relationcontroller).
I found this post :
Reorder of records in relation · Issue #3010 · octobercms/october · GitHub
The guy end up doing a custom solution but this is back in 2017. Wondering if a native solution was implemented? Simple Tree was the closest thing that I found (but still not sure how to implement it).
Took me 2 minutes looking at that documentation.
Awesome, thank you.