255], ]; } public function behaviors() { return [ [ 'class' => TimestampBehavior::class, 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['update_time', 'create_time'], ActiveRecord::EVENT_BEFORE_UPDATE => 'update_time' ] ] ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'store_id' => 'Store ID', 'type' => '1.谢谢惠顾 2.商品', 'name' => '奖品名称', 'image_url' => '图片', 'winning_rate' => '中奖率', 'stock' => '库存', 'gift_id' => '赠品', 'create_time' => 'Create Time', 'update_time' => 'Update Time', 'user_id' => '指定中奖用户id', ]; } public function getGift() { return $this->hasOne(Goods::className(), ['id' => 'gift_id']); } }