admin/app/frontend/modules/cart/discount/models/PreCartGoodsDiscount.php

37 lines
661 B
PHP

<?php
/**
* Created by PhpStorm.
*
*
*
* Date: 2021/4/30
* Time: 15:54
*/
namespace app\frontend\modules\cart\discount\models;
use app\frontend\modules\cart\models\CartBaseModel;
use app\frontend\modules\cart\models\CartGoods;
class PreCartGoodsDiscount extends CartBaseModel
{
public $cartGoods;
public function setCartGoods(CartGoods $cartGoods)
{
$this->cartGoods = $cartGoods;
$this->cartGoods->getCartGoodsDiscounts()->push($this);
}
public function toArray()
{
$this->amount = sprintf('%.2f', $this->amount);
return parent::toArray(); // TODO: Change the autogenerated stub
}
}