FleetCart/Modules/Order/OrderCollection.php
2023-06-11 13:14:03 +01:00

20 lines
397 B
PHP

<?php
namespace Modules\Order;
use Modules\Support\Money;
use Modules\Order\Entities\Order;
use Illuminate\Support\Collection;
class OrderCollection extends Collection
{
public function sumTotal()
{
$total = $this->sum(function (Order $order) {
return $order->total->amount();
});
return Money::inDefaultCurrency($total);
}
}