mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-06 18:12:50 +08:00
完成简约蓝官网皮肤
This commit is contained in:
@@ -33,6 +33,18 @@ class Post extends Model
|
||||
return $this->hasMany(PostTag::class,'post_id');
|
||||
}
|
||||
|
||||
public function setPublishTimeAttr($value)
|
||||
{
|
||||
return strtotime($value);
|
||||
}
|
||||
public function getPublishTimeTextAttr()
|
||||
{
|
||||
|
||||
$value = $this->getData('publish_time');
|
||||
return date('Y-m-d',$value);
|
||||
}
|
||||
|
||||
|
||||
public function getCategorysListAttr()
|
||||
{
|
||||
$list_post_categorys = $this->getAttr('categorys');
|
||||
@@ -50,8 +62,6 @@ class Post extends Model
|
||||
|
||||
$list = array_column($list_post_tags->append(['tag'])->toArray(),'tag');
|
||||
|
||||
$list = array2level($list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
@@ -66,6 +76,29 @@ class Post extends Model
|
||||
return $desc;
|
||||
}
|
||||
|
||||
public function getDescListAttr()
|
||||
{
|
||||
$desc = $this->getData('desc');
|
||||
|
||||
if(empty($desc)){
|
||||
return '';
|
||||
}
|
||||
$list = explode("\n", $desc);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function getDescHtmlAttr()
|
||||
{
|
||||
$desc = $this->getData('desc');
|
||||
|
||||
if(empty($desc)){
|
||||
return '';
|
||||
}
|
||||
|
||||
return str_replace("\n",'<br>',$desc);
|
||||
}
|
||||
|
||||
public function getStatusNameAttr()
|
||||
{
|
||||
return self::$stausNameList[$this->getData('status')];
|
||||
|
||||
Reference in New Issue
Block a user