Get Child Models order by a different attribute

Hi ,

I have Parent - Children model structure.

Children model has an attribute call "sort_order".

When I call $parent->children, the list is ordered by the primary key of the Children model.

How can I order the child items by "sort_order"?

**I want to call the list of children using [size="2"]$parent->children.[/size]



Thank you.


You can set the order property in your relation definition -