diff --git a/app/model/Post.php b/app/model/Post.php index 055b276..c3b8752 100644 --- a/app/model/Post.php +++ b/app/model/Post.php @@ -14,6 +14,11 @@ class Post extends Model { // + public static $stausNameList = [ + 0=>'不发布', + 1=>'发布' + ]; + use SoftDelete; protected $defaultSoftDelete = 0; @@ -28,6 +33,11 @@ class Post extends Model return $this->hasMany(PostTag::class,'post_id'); } + public function getStatusNameAttr() + { + return self::$stausNameList[$this->getData('status')]; + } + public function setPubishTimeAttr($value) { return strtotime($value); diff --git a/view/admin/post/index.html b/view/admin/post/index.html index a182d3d..7c4bdd8 100644 --- a/view/admin/post/index.html +++ b/view/admin/post/index.html @@ -44,6 +44,7 @@