How to Search With Vendor Name As Well?
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', 'APITicketInvoiceController@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...
Image For Better Understanding:
javascript laravel vue.js vuejs2 axios
add a comment |
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', 'APITicketInvoiceController@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...
Image For Better Understanding:
javascript laravel vue.js vuejs2 axios
obviously the column is NOT namedvendor_company_name
maybe it is namedrelated_vendor
instead?
– Nikos M.
Nov 15 '18 at 19:32
@NikosM. I resolved my issue by the answer below Thanks for your support.
– Saif Zakir
Nov 15 '18 at 22:43
add a comment |
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', 'APITicketInvoiceController@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...
Image For Better Understanding:
javascript laravel vue.js vuejs2 axios
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', 'APITicketInvoiceController@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...
Image For Better Understanding:
javascript laravel vue.js vuejs2 axios
javascript laravel vue.js vuejs2 axios
asked Nov 15 '18 at 18:57
Saif ZakirSaif Zakir
8410
8410
obviously the column is NOT namedvendor_company_name
maybe it is namedrelated_vendor
instead?
– Nikos M.
Nov 15 '18 at 19:32
@NikosM. I resolved my issue by the answer below Thanks for your support.
– Saif Zakir
Nov 15 '18 at 22:43
add a comment |
obviously the column is NOT namedvendor_company_name
maybe it is namedrelated_vendor
instead?
– Nikos M.
Nov 15 '18 at 19:32
@NikosM. I resolved my issue by the answer below Thanks for your support.
– Saif Zakir
Nov 15 '18 at 22:43
obviously the column is NOT named
vendor_company_name
maybe it is named related_vendor
instead?– Nikos M.
Nov 15 '18 at 19:32
obviously the column is NOT named
vendor_company_name
maybe it is named related_vendor
instead?– Nikos M.
Nov 15 '18 at 19:32
@NikosM. I resolved my issue by the answer below Thanks for your support.
– Saif Zakir
Nov 15 '18 at 22:43
@NikosM. I resolved my issue by the answer below Thanks for your support.
– Saif Zakir
Nov 15 '18 at 22:43
add a comment |
2 Answers
2
active
oldest
votes
You are trying to get at a lower level, you need to look at vendor.vendor_company_name you are skipping the vendor part.
->orWhere('vendor.vendor_company_name','LIKE',"%$search%");
I resolved my issue by the answer below Thanks for your support. @Linuxuser07
– Saif Zakir
Nov 15 '18 at 22:44
add a comment |
It isnt working because i write orWhere('vendor_company_name','LIKE',"%$search%"), but vendor is relationship and i need to write instead last orWhere something like:
->orWhereHas('vendor', function($query) use ($search)
$query->where('vendor_company_name', 'LIKE', "%$search%");
);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326211%2fhow-to-search-with-vendor-name-as-well%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are trying to get at a lower level, you need to look at vendor.vendor_company_name you are skipping the vendor part.
->orWhere('vendor.vendor_company_name','LIKE',"%$search%");
I resolved my issue by the answer below Thanks for your support. @Linuxuser07
– Saif Zakir
Nov 15 '18 at 22:44
add a comment |
You are trying to get at a lower level, you need to look at vendor.vendor_company_name you are skipping the vendor part.
->orWhere('vendor.vendor_company_name','LIKE',"%$search%");
I resolved my issue by the answer below Thanks for your support. @Linuxuser07
– Saif Zakir
Nov 15 '18 at 22:44
add a comment |
You are trying to get at a lower level, you need to look at vendor.vendor_company_name you are skipping the vendor part.
->orWhere('vendor.vendor_company_name','LIKE',"%$search%");
You are trying to get at a lower level, you need to look at vendor.vendor_company_name you are skipping the vendor part.
->orWhere('vendor.vendor_company_name','LIKE',"%$search%");
edited Nov 15 '18 at 20:27
answered Nov 15 '18 at 20:17
Linuxuser07Linuxuser07
214
214
I resolved my issue by the answer below Thanks for your support. @Linuxuser07
– Saif Zakir
Nov 15 '18 at 22:44
add a comment |
I resolved my issue by the answer below Thanks for your support. @Linuxuser07
– Saif Zakir
Nov 15 '18 at 22:44
I resolved my issue by the answer below Thanks for your support. @Linuxuser07
– Saif Zakir
Nov 15 '18 at 22:44
I resolved my issue by the answer below Thanks for your support. @Linuxuser07
– Saif Zakir
Nov 15 '18 at 22:44
add a comment |
It isnt working because i write orWhere('vendor_company_name','LIKE',"%$search%"), but vendor is relationship and i need to write instead last orWhere something like:
->orWhereHas('vendor', function($query) use ($search)
$query->where('vendor_company_name', 'LIKE', "%$search%");
);
add a comment |
It isnt working because i write orWhere('vendor_company_name','LIKE',"%$search%"), but vendor is relationship and i need to write instead last orWhere something like:
->orWhereHas('vendor', function($query) use ($search)
$query->where('vendor_company_name', 'LIKE', "%$search%");
);
add a comment |
It isnt working because i write orWhere('vendor_company_name','LIKE',"%$search%"), but vendor is relationship and i need to write instead last orWhere something like:
->orWhereHas('vendor', function($query) use ($search)
$query->where('vendor_company_name', 'LIKE', "%$search%");
);
It isnt working because i write orWhere('vendor_company_name','LIKE',"%$search%"), but vendor is relationship and i need to write instead last orWhere something like:
->orWhereHas('vendor', function($query) use ($search)
$query->where('vendor_company_name', 'LIKE', "%$search%");
);
answered Nov 15 '18 at 22:45
Saif ZakirSaif Zakir
8410
8410
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326211%2fhow-to-search-with-vendor-name-as-well%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
obviously the column is NOT named
vendor_company_name
maybe it is namedrelated_vendor
instead?– Nikos M.
Nov 15 '18 at 19:32
@NikosM. I resolved my issue by the answer below Thanks for your support.
– Saif Zakir
Nov 15 '18 at 22:43