Closed ashandi closed 7 years ago
did you solve it?
No, I chose another package.
Which package did you choose? Happy with it?
I started to use elasticsearch. It is really cool tool.
as the error clearly states the domain_id is in the where clause but you don't have it in the searchable columns it has nothing to do with this package but with your query that gets search applied to it. simply prefix the domain_id with the correct table (orders.domain_id) in the where and all should be golden
the problem would we present in any join you make between these two tables
@Tamrael , thanks for your answer!
But I don't know how to control the query. I just put the $searchable array to my Order model and called:
Order::search('any string', null, true)->get();
and I caught this error. Query was totally constructed by this package.
@ashandi are there any scopes on the order model that use the domain_id? in general the query generated only includes the fields in the where that already were present when search() was called. the fields in the searchable column are used in a select but that's about it.
quite strange you got this error but since you moved to another plugin i figure you can't reproduce the old behavior without much hassle
@Tamrael I real good read the Order model and saw that there was a scope
public function scopeForDomain($query, int $domainId)
{
return $query->where('domain_id', $domainId);
}
I think the error was caused by this. I'm really sorry that I wasted your time, but it's good that we solved this problem.
ambiguous columns I dont even want that column involved in the searches 'columns' => [ 'students.fname' => 10, 'students.lname' => 10, 'students.mname' => 10, 'students.school_id'=>0, 'transactions.school_id'=>0, ], 'joins' => [ 'students' => ['transactions.student_id','students.id'], ], it still gives errors
Hello!
I have a database with next structure:
In my Order Model I put next code:
As the result, I caught next error:
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'domain_id' in where clause is ambiguous
The reason of this error is duplicate column 'domain_id' in the both tables.
Is there any way to choose columns of 'users' table which will be joining at the searching?