/** * Determines the children sorting * * @param HasMany $children */ public function determineChildrenSorting(HasMany $children) { if (in_array($this->children_order, $this->translatedAttributes)) { $children->sortedBySourceAttribute($this->children_order, $this->children_order_direction); } else { $children->orderBy($this->children_order, $this->children_order_direction); } }