Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
客户有很多账户,账户有很多交易。
我想从一位客户那里获得所有交易..?
$customer = Auth::user(); $statement = $customers->accounts()->transactions()->where('customer_no', '=', $customer->customer_no)->get(); //get all transactions
我知道这不起作用,但这是我能得到的最接近的..
$customer = Auth::user(); $account_ids = $customers->accounts()->lists('id'); $statement = Transaction::where_in('account_id', $account_ids)->where('customer_no', '=', $customer->customer_no)->get(); // Get all transactions
您可能不需要“customer_no”部分 b/c