I have 3 tables
locationables |locations | account_doctor
-----------------+--------------+------------------+
**id** |**id** |**account_id** |
location_id | | |
locationable_id | | |
locationable_type| | |
would you please help me how can i write many to many polymorphic relationship between them?
I have read Laravel documentation but primary key of account_doctor table doesn't have standard conevtion cause of that relationship doesn't retrieve anything
this is my relations:
AccountDoctor model:
public function locations()
{
return $this->morphToMany(Location::class, 'locationable','locationable');
}
Location model:
public function accountDoctors()
{
return $this->morphedByMany(AccountDoctor::class, 'locationable','locationable');
}
DB::enableQueryLog()...dostuffheredd(DB::getQueryLog())or install laravel debugbar, or try out different parameters for the relation function - Flame