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

python - Strange behavior using PyQt4's 'pyqtSlot' decorator before another decorator -

c# - UnhandledExceptionMode.ThrowException for AppDomain.UnhandledException -

c# - Process.Kill() returns access denied -