Laravel elokwentna suma pomnożonych kolumn
$amount = Transaction::sum(\DB::raw('jumla * harga'));
Nervous Narwhal
$amount = Transaction::sum(\DB::raw('jumla * harga'));
$amount = Transaction::all()->sum(function($t){
return $t->jumlah * $t->harga;
});
$amount = Transaction::select(DB::raw('sum(jumlah * harga) as total'))->get();