OauthAccessTokens.php
1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace filsh\yii2\oauth2server\models;
use Yii;
/**
* This is the model class for table "oauth_access_tokens".
*
* @property string $access_token
* @property string $client_id
* @property integer $user_id
* @property string $expires
* @property string $scope
*
* @property OauthClients $client
*/
class OauthAccessTokens extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%oauth_access_tokens}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['access_token', 'client_id', 'expires'], 'required'],
[['user_id'], 'integer'],
[['expires'], 'safe'],
[['access_token'], 'string', 'max' => 40],
[['client_id'], 'string', 'max' => 32],
[['scope'], 'string', 'max' => 2000]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'access_token' => 'Access Token',
'client_id' => 'Client ID',
'user_id' => 'User ID',
'expires' => 'Expires',
'scope' => 'Scope',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getClient()
{
return $this->hasOne(OauthClients::className(), ['client_id' => 'client_id']);
}
}