feat: add community post categories and channels
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\community;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\service\FileService;
|
||||
|
||||
class CommunityCategory extends BaseModel
|
||||
{
|
||||
protected $name = 'community_post_category';
|
||||
|
||||
public function getIconAttr($value): string
|
||||
{
|
||||
return trim((string) $value) ? FileService::getFileUrl((string) $value) : '';
|
||||
}
|
||||
|
||||
public function setIconAttr($value): string
|
||||
{
|
||||
return trim((string) $value) ? FileService::setFileUrl($value) : '';
|
||||
}
|
||||
}
|
||||
@@ -26,4 +26,9 @@ class CommunityPost extends BaseModel
|
||||
{
|
||||
return $this->belongsToMany(CommunityTag::class, 'la_community_post_tag', 'tag_id', 'post_id');
|
||||
}
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(CommunityCategory::class, 'category_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user