/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
common/kdf/KMobile.php
58 строк
1 KB
Developer
Initial commit
03 авг 2026, 17:43
03 авг 2026, 17:43
7433917
Код
Авторство
О чём код?
<?php namespace common\kdf; use Yii; use yii\helpers\ArrayHelper; /** * This is the model class for table "k_mobile". * * @property string $title Full name * @property string $code Code * * @author Dmitry E. Semenov <sde.tomsk@gmail.com> * @copyright Self (c) 2020 */ class KMobile extends \common\kdf\base\BaseKdf { const DESKTOP = 1; const TABLET = 2; const MOBILE = 2; /** * {@inheritdoc} */ public static function tableName() { return 'k_mobile'; } /** * {@inheritdoc} */ public function rules() { return ArrayHelper::merge(parent::rules(), [ [['title', 'code'], 'required'], [['title'], 'string', 'max' => 100], [['code'], 'string', 'max' => 20], [['code'], 'unique'], ]); } /** * Получить идентификатор мобильной платформы * @return int */ public static function getMobileId() { if (Yii::$app->mobileDetect->isMobile()) { return self::MOBILE; } elseif (Yii::$app->mobileDetect->isTablet()) { return self::TABLET; } else { return self::DESKTOP; } } }