HasMany relationship inverse method name.

I have Customer model and Manager model. Where Manager can manage multiple Customer. My Customer model method
public function manager(): BelongsTo
{
return $this->belongsTo(Manager::class);
}
public function manager(): BelongsTo
{
return $this->belongsTo(Manager::class);
}
My Manager model method
public function customers(): HasMany
{
return $this->hasMany(Customer::class);
}
public function customers(): HasMany
{
return $this->hasMany(Customer::class);
}
While I try to associate custom on manager then this error is shown.
Call to undefined method App\Models\Customer::managers()
Call to undefined method App\Models\Customer::managers()
I user MRR (Manage Related Record) for manage relationship. I don't know why it calls managers instead of manager.
2 Replies
Asmit Nepali
Asmit Nepali4mo ago
No description
Asmit Nepali
Asmit Nepali4mo ago
My solution is add inverse relationship on table on MRR, in RM there is a static property called
```php
public function table(Table $table): Table
{
return $table
.....
->inverseRelationship('manager')
}
```php
public function table(Table $table): Table
{
return $table
.....
->inverseRelationship('manager')
}
Want results from more Discord servers?
Add your server