| Current Path : /var/www/html/chatbot/backend/models/ |
| Current File : /var/www/html/chatbot/backend/models/Template.php |
<?php
namespace backend\models;
use Yii;
use backend\models\Ref;
/**
* This is the model class for table "dmg_template".
*
* @property int $dt_id
* @property string $dt_title
* @property string $dt_header
* @property string $dt_body
* @property string $dt_footer
* @property string $dt_type
* @property int $dt_cat
* @property string $dt_code
* @property string $dt_status
* @property string $created_by
* @property string $created_at
* @property string $updated_by
* @property string $updated_at
*/
class Template extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'dmg_template';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['dt_header', 'dt_body', 'dt_footer'], 'string'],
[['dt_cat'], 'integer'],
[['created_at', 'updated_at'], 'safe'],
[['dt_title'], 'string', 'max' => 255],
[['dt_type', 'dt_status'], 'string', 'max' => 5],
[['dt_code'], 'string', 'max' => 10],
[['created_by', 'updated_by'], 'string', 'max' => 50],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'dt_id' => Yii::t('app', 'Dt ID'),
'dt_title' => Yii::t('app', 'Tajuk'),
'dt_header' => Yii::t('app', 'Header'),
'dt_body' => Yii::t('app', 'Kandungan'),
'dt_footer' => Yii::t('app', 'Footer'),
'dt_type' => Yii::t('app', 'Jenis'),
'dt_cat' => Yii::t('app', 'Kategori'),
'dt_code' => Yii::t('app', 'Kod'),
'dt_status' => Yii::t('app', 'Status'),
'created_by' => Yii::t('app', 'Created By'),
'created_at' => Yii::t('app', 'Created At'),
'updated_by' => Yii::t('app', 'Updated By'),
'updated_at' => Yii::t('app', 'Updated At'),
];
}
public function getType()
{
return $this->hasOne(Ref::className(), ['code' => 'dt_type'])->andWhere(['cat' => 'temptype']);
}
public function getCat()
{
return $this->hasOne(Ref::className(), ['code' => 'dt_cat'])->andWhere(['cat' => 'tempcat']);
}
public function getCode()
{
return $this->hasOne(Ref::className(), ['code' => 'dt_code'])->andWhere(['cat' => 'tempcode']);
}
public function getStatus()
{
return $this->hasOne(Ref::className(), ['code' => 'dt_status'])->andWhere(['cat' => 'STS']);
}
}