12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace common\models;
- use Yii;
- /**
- * This is the model class for table "{{%design}}".
- *
- * @property integer $id
- * @property string $nickname
- * @property string $tel
- * @property string $area_id
- * @property integer $c_time
- * @property integer $status
- */
- class Design extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- const STATUS_YES = 10;
- const STATUS_NO = 0;
- public static function tableName()
- {
- return '{{%design}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['c_time'], 'default','value'=>time()],
- [['status'], 'default','value'=>self::STATUS_YES],
- [['nickname','tel','area_id','c_time'], 'required'],
- [['nickname'], 'string','max' => 32],
- [['c_time','status'], 'integer'],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'nickname' => '昵称',
- 'tel' => '手机号',
- 'area_id' => '城市编号',
- 'c_time' => '创建时间',
- 'status' => '状态',
- ];
- }
- public function getCity(){
- return $this->hasOne(Area::className(),['area_id'=>'area_id'])->select("area");
- }
- }
|