I have my InvoiceSearch.php file that has several relation attributes.
I did a search field that works fine but it doesn’t search if the attribute that I’m searching is a relation.
This is my search code:
if ($this->invoice_no) {
$query->andFilterWhere(['or',
['like','invoice_no',$this->invoice_no],
['like','invoiced_to',$this->invoice_no],
['like','invoice_date',$this->invoice_no],
['like','invoice_by',$this->invoice_no],
['like','invoice_total',$this->invoice_no],
['like','branch_id',$this->invoice_no],
['like','invoice_status',$this->invoice_no],
['like','fuel_percent',$this->invoice_no],
['like','from_dt',$this->invoice_no],
['like','to_dt',$this->invoice_no],
['like','last_sent',$this->invoice_no]
]);
}
invoice_no is the id field and it’s the only field that works, the other ones is all relation.
I already added those attributes as safe as well.
Any clue?