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