128], [['content'], 'string', 'max' => 1000], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'title' => '标题', 'content' => '内容', 'created_at' => '发布于', 'user_id' => '用户', ]; } public function behaviors() { return [ [ 'class' => TimestampBehavior::className(), 'updatedAtAttribute' => false, ], [ 'class' => BlameableBehavior::className(), 'createdByAttribute' => 'user_id', 'updatedByAttribute' => false, ], // [ // 'class' => CommentBehavior::className() // ], ]; } public function getUser() { return $this->hasOne(User::className(), ['id' => 'user_id']); } }