-skema migrasi dan menyesuaikan relasi model nya -membuat beberapa trait utuk memisahkan logika
15 lines
251 B
PHP
15 lines
251 B
PHP
<?php
|
|
|
|
namespace App\Traits\Order;
|
|
|
|
trait WithDiscount
|
|
{
|
|
public function updatedFormDiscount(string $value)
|
|
{
|
|
$total = $this->getTotal();
|
|
$discount = replaceCurrency($value);
|
|
|
|
$this->total = $total - $discount;
|
|
}
|
|
}
|