OauthClients.php
2.02 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
namespace filsh\yii2\oauth2server\models;
use Yii;
/**
* This is the model class for table "oauth_clients".
*
* @property string $client_id
* @property string $client_secret
* @property string $redirect_uri
* @property string $grant_types
* @property string $scope
* @property integer $user_id
*
* @property OauthAccessTokens[] $oauthAccessTokens
* @property OauthAuthorizationCodes[] $oauthAuthorizationCodes
* @property OauthRefreshTokens[] $oauthRefreshTokens
*/
class OauthClients extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%oauth_clients}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['client_id', 'client_secret'], 'required'],
[['user_id'], 'integer'],
[['client_id', 'client_secret'], 'string', 'max' => 32],
[['redirect_uri'], 'string', 'max' => 1000],
[['grant_types'], 'string', 'max' => 100],
[['scope'], 'string', 'max' => 2000]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'client_id' => 'Client ID',
'client_secret' => 'Client Secret',
'redirect_uri' => 'Redirect Uri',
'grant_types' => 'Grant Types',
'scope' => 'Scope',
'user_id' => 'User ID',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getOauthAccessTokens()
{
return $this->hasMany(OauthAccessTokens::className(), ['client_id' => 'client_id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getOauthAuthorizationCodes()
{
return $this->hasMany(OauthAuthorizationCodes::className(), ['client_id' => 'client_id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getOauthRefreshTokens()
{
return $this->hasMany(OauthRefreshTokens::className(), ['client_id' => 'client_id']);
}
}