hi guys
so i have many-to-many polymorphic relation between my tables and everything is standard just like the documentation. except i added 'status' on all tables.
tables are like this:
posts
id - integer
name - string
status - string
videos
id - integer
name - string
status - string
tags
id - integer
name - string
status - string
taggables
tag_id - integer
taggable_id - integer
taggable_type - string
status - string
the problem that i'm facing is when i query the related table like this :
$post->tags()->whereStatus('active')->get()
i get an error cause the 'status' exists both on related and pivot table. error is :
SQLSTATE[HY000]: General error: 1 ambiguous column name: status
i searched a bit and people suggested to include related table name in query like :
$post->tags()->where('tags.status', 'active')->get()
this works ,but is there any way i don't add table name in query ??
i'm searching for a clean method like 'wherePivot()' but on related table instead of pivot . somthing like "whereRelated" !!!
any suggestion ??