Your IP : 216.73.216.124


Current Path : /var/www/html/chatbot/backend/models/
Upload File :
Current File : /var/www/html/chatbot/backend/models/ContentGraph.php

<?php

namespace backend\models;

use Yii;
use asinfotrack\yii2\audittrail\behaviors\AuditTrailBehavior;

/**
 * This is the model class for table "content_graph".
 *
 * @property int $content_graph_id
 * @property string $content_graph_title
 * @property string $content_graph_title_en
 * @property string $content_graph_description
 * @property string $content_graph_description_en
 * @property string $content_graph_html
 * @property int $content_graph_status
 * @property string $created_at
 * @property string $created_by
 * @property string $updated_at
 * @property string $updated_by
 * @property string $content_graph_featured
 */
class ContentGraph extends \common\models\Dermaga
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'content_graph';
    }


    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 [
            [['content_graph_title','content_graph_html'], 'required'],
            [['content_graph_status'], 'integer'],
            [['created_at', 'updated_at'], 'safe'],
            [['content_graph_title', 'content_graph_title_en'], 'string', 'max' => 200],
            [['content_graph_html'], 'string', 'max' => 100000],
            [['content_graph_featured'], 'string', 'max' => 1],
            [['content_graph_description', 'content_graph_description_en'], 'string', 'max' => 500],
            [['created_by', 'updated_by'], 'string', 'max' => 300],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'content_graph_id' => Yii::t('app', 'ID'),
            'content_graph_title' => Yii::t('app', 'Tajuk'),
            'content_graph_title_en' => Yii::t('app', 'Tajuk En'),
            'content_graph_description' => Yii::t('app', 'Penerangan'),
            'content_graph_description_en' => Yii::t('app', 'Penerangan En'),
            'content_graph_status' => Yii::t('app', 'Status'),
            'content_graph_html' => Yii::t('app', 'Kod HTML'),
            'content_graph_featured' => Yii::t('app', 'Papar Graf Di Laman Hadapan'),
            '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'),
        ];
    }
}