20], // [['device_identifier'], 'string', 'max' => 255] ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => Yii::t('common/mobiledevice', 'ID'), 'id_card' => Yii::t('common/mobiledevice', 'Id Card'), 'status' => Yii::t('common/mobiledevice', 'Status'), 'device_identifier' => Yii::t('common/mobiledevice', 'Device Identifier'), 'device_name' => Yii::t('common/mobiledevice', 'Device Name'), 'activated_at' => Yii::t('common/mobiledevice', 'Activated At'), 'created_at' => Yii::t('common/mobiledevice', 'Created At'), 'updated_at' => Yii::t('common/mobiledevice', 'Updated At'), ]; } public function behaviors() { return ArrayHelper::merge( [ [ 'class' => TimestampBehavior::className(), 'value' => function(){ return date('Y-m-d H:i:s' ); } ] ], parent::behaviors()); } public static function toStatusHumanReadable($status){ $result = ""; switch ($status){ case self::STATUS_ACTIVE: $result ='Aktív'; break; case self::STATUS_DELETED_MANUAL: $result ='Törölve (m)'; break; case self::STATUS_DELETED_SYSTEM: $result ='Törölve (r)'; break; case self::STATUS_INACTIVE: $result ='Inaktív'; break; } return $result; } public static function findIdentity($id) { self::findOne(['id' => $id]); } public static function findIdentityByAccessToken($token, $type = null) { throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); } public function getId() { return $this->id; } public function getAuthKey() { throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); } public function validateAuthKey($authKey) { throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); } public function getCard() { return $this->hasOne(Card::class, [ 'id_card' => 'id_card' ]); } }