I want to return the sum of \"amount\" from my payments table. There can be many payments for one invoice. The below \"->sum(\'amount\') does not work, it returns:
Call
You can show this package
$invoices = Invoices::withSum('payments:amount')->get();