Browse Source

Order user childs and siblings by birth_order

pull/13/head
Nafies Luthfi 7 years ago
parent
commit
3f86c725aa
  1. 6
      app/User.php

6
app/User.php

@ -104,10 +104,10 @@ class User extends Authenticatable
public function childs() public function childs()
{ {
if ($this->gender_id == 2) { 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') public function profileLink($type = 'profile')
@ -206,7 +206,7 @@ class User extends Authenticatable
} }
}) })
->get();
->orderBy('birth_order')->get();
} }
public function parent() public function parent()

Loading…
Cancel
Save