FleetCart/Modules/Order/OrderCollection.php

20 lines
397 B
PHP
Raw Permalink Normal View History

2023-06-11 12:14:03 +00:00
<?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);
}
}