Hi! I'm Laravel Nova newbie and got a problem I can not idea how to solve:
I have resource eg. Humans. During creating new Human I have to add father, mother and grandfather. All data are stored in the same table - humans. Human belongs to: father, mother, grandfather. Grandfathers, mothers and fathers have many humans.
In resourse file I have:
BelongsTo::make('Human', 'mother'),
BelongsTo::make('Human', 'father'),
BelongsTo::make('Human', 'grandfather'),
, and in model file I have:
public function mother()
{
return $this->belongsTo(Human::class);
}
public function father()
{
return $this->belongsTo(Human::class);
}
public function grandfather()
{
return $this->belongsTo(Human::class);
}
It works, but I don't know how to make own names in resource file for mother, father and grandfather and also I don't know how to make relation HasMany in model to show humans belongs to eg. mother
Thank you for any advice.