ctms/common/models/CAccess.php
2025-04-10 23:19:13 +08:00

76 lines
1.3 KiB
PHP
Executable File

<?php
/**
* @Author: fm453
* @Date: 2019-01-20 12:21:10
* @Last Modified by: fm453
* @Last Modified time: 2019-01-20 12:21:19
* @Email: fm453@lukegzs.com
*/
namespace common\models;
use Yii;
use yii\base\NotSupportedException;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;
use yii\web\IdentityInterface;
class CAccess extends ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%c_access}}';
}
/**
* @inheritdoc
*/
public function behaviors()
{
return [
TimestampBehavior::className(),
];
}
/**
* @inheritdoc
*/
public static function findIdentity($id)
{
return static::findOne(['id' => $id]);
}
/**
* @inheritdoc
*/
public static function findIdentityByAccessToken($token,$type=null)
{
return static::findOne(['accesstoken' => $token]);
}
/**
* Finds user by username
*
* @param string $username
* @return static|null
*/
public static function findByUsername($username)
{
return static::findOne(['username' => $username]);
}
/**
* @inheritdoc
*/
public function getId()
{
return $this->getPrimaryKey();
}
}