1
0
Fork 0
mirror of https://github.com/janickiy/yii2-nomer synced 2025-02-15 03:11:58 +00:00
yii2-nomer/models/Telegram.php
2020-02-05 06:34:26 +03:00

63 lines
1.3 KiB
PHP

<?php
namespace app\models;
use yii\db\ActiveRecord;
/**
* @property integer $id
* @property string $host
* @property integer $port
* @property integer $status
* @property string $tm_last
*/
class Telegram extends ActiveRecord
{
const STATUS_INACTIVE = 0;
const STATUS_ACTIVE = 1;
const STATUS_UNAVAILABLE = 2;
public static function getStatusName($status) {
switch ($status) {
case self::STATUS_INACTIVE: return 'Неактивный';
case self::STATUS_ACTIVE: return 'Активный';
case self::STATUS_UNAVAILABLE: return 'Сервер недоступен';
default: return null;
}
}
/**
* @inheritdoc
*/
public static function tableName()
{
return 'telegrams';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['host', 'port'], 'required'],
[['port', 'status'], 'integer'],
[['tm_last'], 'safe'],
[['host'], 'string', 'max' => 255],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'host' => 'Host',
'port' => 'Port',
'status' => 'Status',
'tm_last' => 'Tm Last',
];
}
}