Your IP : 216.73.216.79


Current Path : /var/www/html/persada/backend/modules/chat/models/
Upload File :
Current File : /var/www/html/persada/backend/modules/chat/models/ChatUser.php

<?php

namespace backend\modules\chat\models;

use Yii;

/**
 * This is the model class for table "chat_user".
 *
 * @property int $user_id
 * @property string $user_name
 * @property string $user_phone
 * @property string|null $user_email
 * @property string|null $live_message_last
 * @property string $create_dttm
 * @property int $user_live_active
 *
 * @property ChatAnswer[] $chatAnswers
 * @property ChatQuestion[] $chatQuestions
 */
class ChatUser extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'chat_user';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['user_name', 'user_phone'], 'required'],
            [['live_message_last'], 'string'],
            [['create_dttm'], 'safe'],
            [['user_live_active'], 'integer'],
            [['user_name'], 'string', 'max' => 1024],
            [['user_phone'], 'string', 'max' => 20],
            [['user_email'], 'string', 'max' => 100],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'user_id' => Yii::t('app', 'User ID'),
            'user_name' => Yii::t('app', 'Name'),
            'user_phone' => Yii::t('app', 'Phone'),
            'user_email' => Yii::t('app', 'Email'),
            'live_message_last' => Yii::t('app', 'Last Message'),
            'create_dttm' => Yii::t('app', 'Chat Date & Time'),
            'user_live_active' => Yii::t('app', 'Live Active'),
        ];
    }

    /**
     * Gets query for [[ChatAnswers]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getChatAnswers()
    {
        return $this->hasMany(ChatAnswer::className(), ['user_id' => 'user_id']);
    }

    /**
     * Gets query for [[ChatQuestions]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getChatQuestions()
    {
        return $this->hasMany(ChatQuestion::className(), ['user_id' => 'user_id']);
    }
}