php - Laravel - Query "with" -


I have a query where I need to get information from 2 tables. So I need to get an invoice with Invoice_State 1, where user_status is 1. However I can ask the invoice table with the user table. When I get a DD ($ invoice) I get an invoice with the user ...

  $ invoices = Invoice :: with ('user') - & gt; Where ('invoice_status', '=', 2) - & gt; get ();  

But I'm not sure how I can get user-> account_status. I tried to do this but found a query error which can not be found on account_states.

  $ invoices = Invoice :: with ('user') - & gt; Where ('invoice_status', '=', 2) - & gt; Where ('account_status', '=', 1) - & gt; get receive ();  

In a closure to handle queries for curious-loaded content Can pass:

function ($ query) {$ query- & gt; where ('account_status', '=', 1);}))) - & gt; Where ('invoice_status', '=', 2) - & gt; get ();

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -