You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
982 B
PHP
51 lines
982 B
PHP
<?php
|
|
|
|
namespace Artmark\Content\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Description of Content
|
|
*
|
|
* @author Andrey Pokidov <pokidov@e-traffic.ru>
|
|
*/
|
|
class Content extends Model
|
|
{
|
|
const MAXIMAL_TITLE_LENGTH = 1024;
|
|
|
|
const STATUS_DRAFT = 0x0;
|
|
const STATUS_PUBLISHED = 0x1;
|
|
|
|
protected $fillable = [
|
|
'title', 'keywords', 'description', 'body'
|
|
];
|
|
|
|
public function isDraft()
|
|
{
|
|
return $this->status == self::STATUS_DRAFT;
|
|
}
|
|
|
|
public function isPublished()
|
|
{
|
|
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');
|
|
}
|
|
}
|