wip
This commit is contained in:
30
app/Models/Ecommerce/Product/Order/Concerns/HasPayments.php
Normal file
30
app/Models/Ecommerce/Product/Order/Concerns/HasPayments.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Ecommerce\Product\Order\Concerns;
|
||||
|
||||
trait HasPayments
|
||||
{
|
||||
/**
|
||||
* Total price for order
|
||||
*/
|
||||
public function total(): float
|
||||
{
|
||||
return $this->items->sum('total');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return total order with shipping.
|
||||
*/
|
||||
public function fullPriceWithShipping(): string
|
||||
{
|
||||
return floatval($this->total()) + floatval($this->shippingPrice()) + floatval($this->additional_tax);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formatted payment type
|
||||
*/
|
||||
public function formattedPaymentType(): string
|
||||
{
|
||||
return $this->paymentType?->name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user