Files
sbnews/server/app/common/model/community/CommunityPost.php
T
2026-06-11 12:15:29 +08:00

30 lines
647 B
PHP

<?php
namespace app\common\model\community;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
class CommunityPost extends BaseModel
{
use SoftDelete;
protected $name = 'community_post';
protected $deleteTime = 'delete_time';
public function getImagesAttr($value)
{
return $value ? json_decode($value, true) : [];
}
public function setImagesAttr($value)
{
return $value ? json_encode($value, JSON_UNESCAPED_UNICODE) : '[]';
}
public function tags()
{
return $this->belongsToMany(CommunityTag::class, 'la_community_post_tag', 'tag_id', 'post_id');
}
}