| Current Path : /var/www/html/dosm/backend/modules/contentStatistics/models/ |
| Current File : /var/www/html/dosm/backend/modules/contentStatistics/models/ContentStatistics.php |
<?php
namespace backend\modules\contentStatistics\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\behaviors\BlameableBehavior;
use yii\db\Expression;
use yii\db\ActiveRecord;
use asinfotrack\yii2\audittrail\behaviors\AuditTrailBehavior;
/**
* This is the model class for table "content_statistics".
*
* @property int $stats_id
* @property string|null $stats_status
* @property string|null $stats_type
* @property int|null $stats_main
* @property int|null $stats_parent_id
* @property string|null $stats_language
* @property string|null $stats_title
* @property string|null $stats_content
* @property string|null $stats_item
* @property string|null $created_at
* @property string|null $created_by
* @property string|null $updated_at
* @property string|null $updated_by
*/
class ContentStatistics extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'content_statistics';
}
public function behaviors() {
return [
'audittrail' => [
'class' => AuditTrailBehavior::className(),
// some of the optional configurations
'ignoredAttributes' => ['created_at', 'updated_at'],
'consoleUserId' => 1,
'attributeOutput' => [
'desktop_id' => function ($value) {
$model = Desktop::findOne($value);
return sprintf('%s %s', $model->manufacturer, $model->device_name);
},
'last_checked' => 'datetime',
],
],
];
}
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['stats_main', 'stats_parent_id'], 'integer'],
[['stats_status', 'stats_language', 'stats_title', 'stats_code'], 'required'],
[['created_at', 'updated_at', 'stats_content', 'stats_item', 'stats_status', 'stats_type', 'stats_language', 'stats_title',
'created_by', 'updated_by', 'stats_img', 'stats_sort', 'stats_type', 'stats_chart'], 'safe'],
[['stats_code'], 'unique'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'stats_id' => Yii::t('app', 'Stats ID'),
'stats_status' => Yii::t('app', 'Status'),
'stats_type' => Yii::t('app', 'Type'),
'stats_main' => Yii::t('app', 'Stats Main'),
'stats_parent_id' => Yii::t('app', 'Stats Parent ID'),
'stats_language' => Yii::t('app', 'Language'),
'stats_title' => Yii::t('app', 'Title'),
'stats_content' => Yii::t('app', 'Description'),
'stats_item' => Yii::t('app', 'Item'),
'created_at' => Yii::t('app', 'Created At'),
'created_by' => Yii::t('app', 'Created By'),
'updated_at' => Yii::t('app', 'Updated At'),
'updated_by' => Yii::t('app', 'Updated By'),
'stats_code' => 'Page Slug',
'stats_img' => 'Thumbnail',
'stats_sort' => 'Sorting',
'stats_chart' => 'Chart Content',
];
}
}