portal.mkgtu.ru/backend/models/CommonSettings.php

43 lines
853 B
PHP
Raw Normal View History

2024-03-28 09:51:45 +03:00
<?php
namespace backend\models;
use Yii;
class CommonSettings extends \yii\db\ActiveRecord
{
public function rules()
{
return [
['show_technical_info_on_error', 'boolean'],
];
}
public function attributeLabels()
{
return [
'show_technical_info_on_error' => Yii::t('settings/main', 'Показывать подробную техническую информацию об ошибках'),
];
}
public static function tableName()
{
return '{{%common_settings}}';
}
public static function getInstance(): CommonSettings
{
$record = CommonSettings::find()->limit(1)->one();
if (!$record) {
$record = new CommonSettings();
$record->loadDefaultValues();
}
return $record;
}
}