+Status methods for content
This commit is contained in:
@@ -29,4 +29,22 @@ class Content extends Model
|
|||||||
{
|
{
|
||||||
return $this->status == self::STATUS_PUBLISHED;
|
return $this->status == self::STATUS_PUBLISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hide()
|
||||||
|
{
|
||||||
|
$this->status = self::STATUS_DRAFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function publish()
|
||||||
|
{
|
||||||
|
$this->status = self::STATUS_PUBLISHED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatusName()
|
||||||
|
{
|
||||||
|
if ($this->isPublished()) {
|
||||||
|
return __('content.status_published');
|
||||||
|
}
|
||||||
|
return __('content.status_draft');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user