mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
add files to project
This commit is contained in:
commit
5cac498444
3729 changed files with 836998 additions and 0 deletions
63
models/Telegram.php
Normal file
63
models/Telegram.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?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',
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue