So, we have a contacts table and a projects table, with a many to many relationship. the pivot table contact_project has a answer_type_id so it belongsTo AnswerType, and it also HasMany sendings.
I'm trying to allow content people to link contacts to projects. So I added:
BelongsToMany::make('Projects')
->fields(function ($request, $relatedModel) {
return [
BelongsTo::make('Answer type'),
DateTime::make('Answered at')
];
}),
And I also tried to define the belongsTo as BelongsTo::make('Answer type', 'answerType', ContactProject::class) but to no avail : Call to undefined method App\Models\Contact::answerType().
I would be grateful for a little help :) Thanks ahead!
Well, it's simply not supported: https://github.com/laravel/nova-issues/issues/5334#issuecomment-1435691794 or https://github.com/laravel/nova-issues/issues/5173#issuecomment-1357614020