Your IP : 216.73.216.79


Current Path : /var/www/html/dosm/backend/models/
Upload File :
Current File : /var/www/html/dosm/backend/models/LifeExpectancyEthnic.php

<?php

namespace backend\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 "life_expectancy".
 *
 */
class LifeExpectancyEthnic extends \yii\db\ActiveRecord {

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

    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 [
            [['ethnic', 'life_expectancy'], 'required']
        ];
    }

    public function attributeLabels() {
        return [
            'id' => Yii::t('app', 'ID'),
            'ethnic' => Yii::t('app', 'Etnik'),
            'life_expectancy' => Yii::t('app', 'Jangka Hayat'),
            'updated_at' => Yii::t('app', 'Updated At')
        ];
    }

}