You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
simple-yewu/common/models/GiftT.php

73 lines
1.6 KiB

<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "gift_t".
*
* @property integer $id
* @property integer $type_id
* @property string $name
* @property string $price
* @property string $remark
* @property integer $total
* @property integer $total_lock
* @property string $created_at
* @property string $updated_at
*/
class GiftT extends \common\models\Base
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'gift_t';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['type_id', 'total', 'total_lock'], 'integer'],
[['name'], 'required'],
[['created_at', 'updated_at'], 'safe'],
[['name'], 'string', 'max' => 100],
[['price'], 'string', 'max' => 50],
[['remark'], 'string', 'max' => 200],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'type_id' => 'Type ID',
'name' => 'Name',
'price' => 'Price',
'remark' => 'Remark',
'total' => 'Total',
'total_lock' => 'Total Lock',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
public function getType()
{
return $this->hasOne(GiftTypeT::className(),['id'=>'type_id']);
}
public function getStrategys()
{
return $this->hasMany(StrategyT::className(),['id'=>'strategy_id'])
->viaTable('gift_strategy_t',['gift_id'=>'id']);
}
}