I'm using Laravel 5.7 & VueJs 2.5.* ...
I have a table with invoice data in it and a invoice is related to the vendor so i also displayed the vendor name in the table, i'm using search feature it works when i search invoice number, but when i want to search with vendor name, its not working.
i did something like this:
I DID THIS IN SCRIPT
mounted() {
Fire.$on("searching", () => {
let query = this.$parent.search;
axios
.get("api/findVTI?q=" + query)
.then(data => {
this.ticketInvoices = data.data;
})
.catch();
});
I MADE A ROUTE
Route::get('findVTI', 'API\TicketInvoiceController@searchVTI');
IN MY INVOICE CONTROLLER I DID THIS
public function searchVTI()
{
if($search = \Request::get('q')){
$VTI = TicketInvoice::where(function($query) use ($search){
$query->where('ticket_invoice_no','LIKE',"%$search%")
->orWhere('ticket_invoice_grand_total','LIKE',"%$search%")
->orWhere('vendor_company_name','LIKE',"%$search%");
})->paginate(10);
}else{
return TicketInvoice::paginate(10);
}
return $VTI;
}
When i write this line:
->orWhere('vendor_company_name','LIKE',"%$search%"); i got an error in console that, vendor_company_name does not exist in ticket_invoices.
I play around with many thing but didn't succeed...
