|
|
<?php
namespace backend\modules\shop\models\ars;
use backend\modules\goods\models\ars\Goods; use Yii; use yii\behaviors\TimestampBehavior;
/** * This is the model class for table "ats_delivery_goods". * * @property int $id * @property int $delivery_id 物流id * @property int $order_goods_id 订单商品id * @property int $goods_id 商品id * @property int $goods_name 商品名称 * @property int $goods_count 商品数量 * @property int $created_at 创建时间 * @property int $updated_at 更新时间 */ class DeliveryGoods extends \yii\db\ActiveRecord { /** * {@inheritdoc} */ public static function tableName() { return 'ats_delivery_goods'; }
/** * {@inheritdoc} */ public function rules() { return [ [['delivery_id', 'order_goods_id', 'goods_id', 'goods_count'], 'integer'], [['goods_name'], 'string'], ]; }
/** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'id', 'delivery_id' => '物流id', 'order_goods_id' => '订单商品id', 'goods_id' => '商品id', 'goods_name' => '商品名称', 'goods_count' => '商品数量', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; }
/** * @author linyao * @email 602604991@qq.com * @created Nov 8, 2019 * * 行为存储创建时间和更新时间 */ public function behaviors() { return [ [ 'class' => TimestampBehavior::className(), 'createdAtAttribute' => 'created_at', 'updatedAtAttribute' => 'updated_at', 'value' => function() { return time(); }, ], ]; }
public function getGoods() { return $this->hasOne(Goods::className(), ['id' => 'goods_id']); }
public function getOrderGoods() { return $this->hasOne(OrderGoods::className(), ['id' => 'order_goods_id']); } }
|