30], [['cover'], 'string', 'max' => 100], [['seo_content'], 'string', 'max' => 1000], [['description', 'content', 'author'], 'string', 'max' => 255], [['seo_key'], 'string', 'max' => 50], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => '序号', 'title' => '标题', 'cover' => '封面', 'seo_content' => 'seo内容', 'description' => '描述', 'seo_key' => 'seo关键字', 'content' => '文章内容', 'view' => '浏览量', 'sort' => '优先级', 'check_max' => '报名人数限制', 'check' => '已报名人数', 'author' => '作者', 'status' => '状态', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; } /** * @param bool $insert * @return bool */ public function beforeSave($insert) { // 推荐位 // $this->position = $this->getPosition(); $this->created_at = StringHelper::dateToInt($this->created_at); $this->updated_at = time(); return parent::beforeSave($insert); } public function getSign() { return $this->hasMany(Sign::class, ['aid' => 'id']); } }