123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace common\models;
- use Yii;
- /**
- * This is the model class for table "{{%user_house}}".
- *
- * @property string $id
- * @property integer $uid
- * @property string $compound
- * @property string $layout
- * @property string $acreage
- * @property string $amount
- * @property string $province
- * @property string $city
- * @property string $district
- * @property string $address
- * @property integer $created_at
- * @property integer $status
- * @property integer $updated_at
- */
- class UserHouse extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- const STATUS_DELETED = 0;
- const STATUS_ACTIVE = 10;
- public static function tableName()
- {
- return '{{%user_house}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['uid', 'created_at', 'status', 'updated_at'], 'integer'],
- [['compound', 'layout', 'acreage', 'province', 'city', 'district'], 'string', 'max' => 32],
- [['amount'], 'string', 'max' => 10],
- [['address','style'], 'string', 'max' => 255],
- [['status'], 'default', 'value' => self::STATUS_ACTIVE],
- [['created_at','updated_at'], 'default', 'value' => time()],
- [['uid'], 'default', 'value' => Yii::$app->user->id],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'uid' => 'Uid',
- 'compound' => '小区名称',
- 'layout' => '户型',
- 'acreage' => '面积',
- 'amount' => '预算',
- 'province' => '省份',
- 'city' => '城市',
- 'district' => '地区',
- 'address' => '详细地址',
- 'created_at' => '创建时间',
- 'status' => '状态',
- 'style' => '装修风格',
- 'updated_at' => 'Updated At',
- ];
- }
- public function getUserinfo(){
- return $this->hasOne(User::className(),['id'=>'uid']);
- }
- public function getNickname(){
- return $this->hasOne(UserInfo::className(),['uid'=>'uid']);
- }
- }
|