Your IP : 216.73.216.79


Current Path : /var/www/html/ebookingdbkl/common/models/
Upload File :
Current File : /var/www/html/ebookingdbkl/common/models/FrontendUserDependent.php

<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "frontend_user_dependent".
 *
 * @property int $dependent_id
 * @property int|null $frontend_user_fk
 * @property string $fullname
 * @property string $title
 * @property string $dob
 * @property string $marital_status
 * @property string $marriage_date
 * @property string $gender
 * @property string $mobile_no
 * @property string $id_type
 * @property string $ic_number
 * @property string $race
 * @property string $religion
 * @property string $address
 * @property string $address_1
 * @property string $address_2
 * @property string $postcode
 * @property string $state
 * @property string $created_at
 * @property int $created_by
 * @property string $updated_at
 * @property int $updated_by
 *
 * @property FrontendUser $frontendUserFk
 */
class FrontendUserDependent extends \yii\db\ActiveRecord
{

    public $birth_document;

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'frontend_user_dependent';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['frontend_user_fk', 'created_by', 'updated_by'], 'integer'],
            [['fullname', 'gender', 'dob', 'dependent_relationship'], 'required'],
            [['marriage_date', 'data_source', 'created_at', 'updated_at', 'birth_document', 'child_custody', 'title', 'marital_status', 'marriage_date', 'mobile_no', 'id_type', 'ic_number', 'race', 'religion', 'address', 'address_1', 'address_2', 'postcode', 'state', 'created_by', 'updated_at', 'updated_by', 'dependent_id'], 'safe'],
            [['fullname'], 'string', 'max' => 500],
            [['title', 'id_type', 'race', 'religion', 'state'], 'string', 'max' => 2],
            [['marital_status'], 'string', 'max' => 5],
            [['gender'], 'string', 'max' => 1],
            [['mobile_no'], 'string', 'max' => 24],
            [['ic_number'], 'string', 'max' => 20],
            [['address', 'address_1', 'address_2'], 'string', 'max' => 400],
            [['postcode'], 'string', 'max' => 10],
            // [['frontend_user_fk'], 'exist', 'skipOnError' => true, 'targetClass' => FrontendUser::className(), 'targetAttribute' => ['frontend_user_fk' => 'id']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'dependent_id' => Yii::t('app', 'Dependent ID'),
            'frontend_user_fk' => Yii::t('app', 'Frontend User Fk'),
            'fullname' => Yii::t('app', 'Fullname'),
            'title' => Yii::t('app', 'Title'),
            'dob' => Yii::t('app', 'Dob'),
            'marital_status' => Yii::t('app', 'Marital Status'),
            'marriage_date' => Yii::t('app', 'Marriage Date'),
            'gender' => Yii::t('app', 'Gender'),
            'mobile_no' => Yii::t('app', 'Mobile No'),
            'id_type' => Yii::t('app', 'Id Type'),
            'ic_number' => Yii::t('app', 'Ic Number'),
            'race' => Yii::t('app', 'Race'),
            'religion' => Yii::t('app', 'Religion'),
            'address' => Yii::t('app', 'Address'),
            'address_1' => Yii::t('app', 'Address 1'),
            'address_2' => Yii::t('app', 'Address 2'),
            'postcode' => Yii::t('app', 'Postcode'),
            'state' => Yii::t('app', 'State'),
            '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'),
        ];
    }

    /**
     * Gets query for [[FrontendUserFk]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getFrontendUserFk()
    {
        return $this->hasOne(FrontendUser::className(), ['id' => 'frontend_user_fk']);
    }

      /**
     * Gets query for [[QuatersApplicationAttachments]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getQuatersApplicationAttachments()
    {
        return $this->hasOne(\backend\modules\quaters\models\QuatersApplicationAttachment::className(), ['dependent_fk' => 'dependent_id'])->orderBy(['application_attachment_id'=>SORT_DESC]);
    }
}