[WIP] Fix Person

This commit is contained in:
R
2022-11-02 11:45:01 +07:00
parent 1067f9e313
commit 429dc476e2
5 changed files with 85 additions and 12 deletions

View File

@@ -88,8 +88,18 @@ class Person extends Model
return $this->morphOne(File::class, 'fileable')->where('type', 'avatar')->latestOfMany();
}
public function families()
{
return $this->belongsToMany(Person::class, 'family_relations', 'owner_id', 'person_id')->withPivot(['relation_with_owner']);
}
public function familyOwner()
{
return $this->hasOne(Family::class, 'person_id');
}
public function user()
{
return $this->hasOne(User::class, 'person_id');
}
}