diff options
Diffstat (limited to 'model/Tag.php')
-rw-r--r-- | model/Tag.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/model/Tag.php b/model/Tag.php new file mode 100644 index 0000000..a8324f7 --- /dev/null +++ b/model/Tag.php @@ -0,0 +1,24 @@ +<?php + +class Tag extends Model implements Stringable { + + const DB_TABLE = 'tags'; + + public int $id; + public string $tag; + public int $postsCount; + public int $visiblePostsCount; + + public function getUrl(): string { + return '/'.$this->tag.'/'; + } + + public function getPostsCount(bool $is_admin): int { + return $is_admin ? $this->postsCount : $this->visiblePostsCount; + } + + public function __toString(): string { + return $this->tag; + } + +} |