diff --git a/app/User.php b/app/User.php index db7b068..cfdf3e2 100644 --- a/app/User.php +++ b/app/User.php @@ -104,10 +104,10 @@ class User extends Authenticatable public function childs() { if ($this->gender_id == 2) { - return $this->hasMany(User::class, 'mother_id'); + return $this->hasMany(User::class, 'mother_id')->orderBy('birth_order'); } - return $this->hasMany(User::class, 'father_id'); + return $this->hasMany(User::class, 'father_id')->orderBy('birth_order'); } public function profileLink($type = 'profile') @@ -206,7 +206,7 @@ class User extends Authenticatable } }) - ->get(); + ->orderBy('birth_order')->get(); } public function parent()