EMfinanga
3 weeks ago
202
15
Laravel

find collection by id

Posted 3 weeks ago by EMfinanga

i have two table which is related, i want to select some data where the id is equal to selected, and display in blade

i tried this but get the below error.

 Property [customer] does not exist on this collection instance. 

my code:

         $customer_ledger=Sales::with('customer')
                   -> select('invoice_no','customer_id','created_at',DB::raw('sum(amount) as totalM'))
                   ->where('customer_id', $id)
                     ->groupby('invoice_no','customer_id','created_at')
                      ->get();

Please sign in or create an account to participate in this conversation.