nicolaslopezj / searchable

A php trait to search laravel models
MIT License
2.01k stars 291 forks source link

Duplicate Columns #187

Open Justicea83 opened 5 years ago

Justicea83 commented 5 years ago

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 gives errors

ricardo commented 2 years ago

The problem is probably on another query of yours, not searchable. E.g if the ambiguous column is school_id:

$transactions = Transaction::where('school_id', $school_id)->search($search);

You could do as such:

$transactions = Transaction::where('transactions.school_id', $school_id)->search($search);