100 ], [ [ 'description', 'value' ], 'string', 'max' => 1000 ], [ ['value'], 'number', 'min' => ChatSettings::MIN_REQUEST_INTERVAL, 'max' => ChatSettings::MAX_REQUEST_INTERVAL, 'when' => function ($model) { return $model->name === ChatSettings::PARAM_REQUEST_INTERVAL; }, 'whenClient' => "function(attribute, value) { return false; }" ], [ ['value'], 'required', 'when' => function ($model) { return $model->name === ChatSettings::PARAM_REQUEST_INTERVAL; }, 'whenClient' => "function(attribute, value) { return false; }" ] ]; } public function attributeLabels() { return ['value' => $this->description]; } public static function getValueByName(string $name): string { $setting = ChatSettings::findOne(['name' => $name]); if ($setting) { return $setting->value; } return ''; } }