Closed JordanR-Surge closed 1 year ago
I found a work around for the time being, it isn't the best though. If you add the model as a relation to itself then you can use a relation filter to get the where clause to behave.
Not very ideal but it works
@JordanR-Surge This package doesn't support add an alias table in all conditions. You are right. I'll try to fix it in later versions.
When an Eloquent query contains a join the where clause generated by the filters becomes ambiguous
To Reproduce Steps to reproduce the behavior:
This type of query will break due to an ambiguous column in the sql
Users::select('users.name')->join('posts', 'posts.user_id', '=', 'users.id')->filter(['name' => 'test'])->get()
Sql Generated: SELECT
users
.name
FROMusers
JOINposts
ONposts
.user_id
=users
.id
WHEREname
=test
;To Fix Add the table name to the where clauses, maybe there could be a config for this?