'array', ]; // 开启自动写入时间戳字段 protected $autoWriteTimestamp = true; /** * 关联 user表 * @return \think\model\relation\BelongsTo */ public function user() { return $this->belongsTo('UserModel', 'user_id')->setEagerlyType(1); } /** * 关联分类表 * @return \think\model\relation\BelongsToMany */ public function categories() { return $this->belongsToMany('PortalCategoryModel', 'portal_category_post', 'category_id', 'post_id'); } /** * 关联标签表 * @return \think\model\relation\BelongsToMany */ public function tags() { return $this->belongsToMany('PortalTagModel', 'portal_tag_post', 'tag_id', 'post_id'); } /** * post_content 自动转化 * @param $value * @return string */ public function getPostContentAttr($value) { return cmf_replace_content_file_url(htmlspecialchars_decode($value)); } }