BlameableBehavior::className(), 'createdByAttribute' => 'user_id', 'updatedByAttribute' => false, ], [ 'class' => TimestampBehavior::className(), 'createdAtAttribute' => 'date_add', 'updatedAtAttribute' => false, 'value' => new Expression('NOW()'), ], ]; } /** * @inheritdoc */ public function rules() { return [ [ [ 'firstname', 'lastname', 'position', 'country_id', ], 'required', ], [ [ 'department_id', ], 'integer', ], [ [ 'experience_from', ], 'integer', 'max' => date('Y'), 'min' => 1950, ], [ [ 'experience_from', ], 'safe', ], [ [ 'firstname', 'lastname', 'middlename', 'link', 'position', 'photo', 'country_id', ], 'string', 'max' => 255, ], [ ['link'], 'default', 'value' => '', ], [ ['link'], 'match', 'pattern' => '/^(?:https?:\/\/)?(?:w{3}\.)?'.preg_quote($_SERVER['HTTP_HOST']).'\/performer\/\w+\/\d+$/i', ] ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'team_id' => Yii::t('app', 'team_id'), 'user_id' => Yii::t('app', 'user_id'), 'firstname' => Yii::t('app', 'firstname'), 'lastname' => Yii::t('app', 'lastname'), 'middlename' => Yii::t('app', 'middlename'), 'link' => Yii::t('app', 'link_profile'), 'position' => Yii::t('app', 'position'), 'department_id' => Yii::t('app', 'department_id'), 'experience_from' => Yii::t('app', 'experience_from'), 'date_add' => Yii::t('app', 'date_add'), 'user_add_id' => Yii::t('app', 'user_add_id'), 'photo' => Yii::t('app', 'photo'), 'country_id' => Yii::t('app', 'country_id'), ]; } public function getDepartment() { return $this->hasOne(Department::className(), [ 'department_id' => 'department_id' ]); } public function getUser() { return $this->lastname. ' ' . $this->firstname; } }