| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 | 
							- <?php
 
- namespace common\models;
 
- use common\behaviors\CommentBehavior;
 
- use common\modules\user\models\User;
 
- use Yii;
 
- use yii\behaviors\BlameableBehavior;
 
- use yii\behaviors\TimestampBehavior;
 
- /**
 
-  * This is the model class for table "{{%search_record}}".
 
-  *
 
-  * @property integer $id
 
-  * @property string $keyword
 
-  * @property integer $created_at
 
-  * @property integer $updated_at
 
-  * @property integer $user_id
 
-  * @property integer $count
 
-  * @property integer $del
 
-  */
 
- class SearchRecord extends \yii\db\ActiveRecord
 
- {
 
-     /**
 
-      * @inheritdoc
 
-      */
 
-     public static function tableName()
 
-     {
 
-         return '{{%search_record}}';
 
-     }
 
-     /**
 
-      * @inheritdoc
 
-      */
 
-     public function rules()
 
-     {
 
-         return [
 
-             [['keyword'], 'required'],
 
-             [['user_id','count','del'], 'integer'],
 
-             [['keyword'], 'string', 'max' => 128],
 
-         ];
 
-     }
 
-     /**
 
-      * @inheritdoc
 
-      */
 
-     public function attributeLabels()
 
-     {
 
-         return [
 
-             'id' => 'ID',
 
-             'keyword' => '关键词',
 
-             'created_at' => 'created_at',
 
-             'updated_at' => 'updated_at',
 
-             'user_id' => '用户',
 
-             'count' => '次数',
 
-             'del' => '是否已删除',
 
-         ];
 
-     }
 
-     public function behaviors()
 
-     {
 
-         return [
 
-             [
 
-                 'class' => TimestampBehavior::className(),
 
-             ],
 
-             [
 
-                 'class' => BlameableBehavior::className(),
 
-                 'createdByAttribute' => 'user_id',
 
-                 'updatedByAttribute' => false,
 
-             ],
 
-         ];
 
-     }
 
-     public function getUser()
 
-     {
 
-         return $this->hasOne(User::className(), ['id' => 'user_id']);
 
-     }
 
- }
 
 
  |