belongsTo(User::class)->withDefault(['name' => 'N/A']); } public function wife() { return $this->belongsTo(User::class)->withDefault(['name' => 'N/A']); } public function childs() { return $this->hasMany(User::class, 'parent_id')->orderBy('birth_order'); } public function addChild(User $user) { $user->id = Uuid::uuid4()->toString(); $user->parent_id = $this->id; $user->father_id = $this->husband_id; $user->mother_id = $this->wife_id; $user->save(); } public function manager() { return $this->belongsTo(User::class); } }