| Current Path : /var/www/html/drsa/backend/modules/contentPoll/models/ |
| Current File : /var/www/html/drsa/backend/modules/contentPoll/models/ContentPoll.php |
<?php
namespace backend\modules\contentPoll\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_poll".
*
* @property int $poll_id
* @property string|null $poll_status
* @property int|null $poll_main
* @property int|null $poll_parent_id
* @property string|null $poll_language
* @property string|null $poll_question
* @property string|null $poll_answer
* @property string|null $created_at
* @property string|null $created_by
* @property string|null $updated_at
* @property string|null $updated_by
*/
class ContentPoll extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'content_poll';
}
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 [
[['poll_status', 'poll_language', 'poll_question'], 'required'],
[['poll_main', 'poll_parent_id'], 'integer'],
[['poll_answer'], 'string'],
[['created_at', 'updated_at', 'poll_status', 'poll_language', 'poll_question', 'created_by', 'updated_by', 'poll_sorting'], 'safe'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'poll_id' => Yii::t('app', 'Poll ID'),
'poll_status' => Yii::t('app', 'Status'),
'poll_main' => Yii::t('app', 'Poll Main'),
'poll_parent_id' => Yii::t('app', 'Poll Parent ID'),
'poll_language' => Yii::t('app', 'Language'),
'poll_question' => Yii::t('app', 'Question'),
'poll_answer' => Yii::t('app', 'Answer'),
'poll_sorting' => Yii::t('app', 'Sorting'),
'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'),
];
}
}