Hi, I have a table contracts and two other tables: agencies and hotels. A contract contains atleast one agency or hotel but can contain unlimited. So I decided to use a polymorphic many-to-many relation in this case. Somehow, the documentation confuses me and it seems like I can't use polymorphic on this case.
Agency.php
public function contracts(): MorphToMany
{
return $this->morphToMany(Contract::class, 'contractable');
}
Hotel.php
public function contracts(): MorphToMany
{
return $this->morphToMany(Contract::class, 'contractable');
}
Contract.php
???