Files
xk-api-yii/common/modelsgii/AuthItem.php
2024-09-19 11:32:39 +08:00

103 lines
2.4 KiB
PHP

<?php
namespace common\modelsgii;
use Yii;
/**
* This is the model class for table "yii_auth_item".
*
* @property string $name 角色或权限名称
* @property int $type 1角色 2权限
* @property string|null $description
* @property string|null $rule_name
* @property string|null $data
* @property int|null $created_at
* @property int|null $updated_at
*
* @property AuthItemChild[] $authItemChildren
* @property AuthItemChild[] $authItemChildren0
* @property AuthItem[] $children
* @property AuthItem[] $parents
*/
class AuthItem extends \common\core\BaseActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'yii_auth_item';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name', 'type'], 'required'],
[['type', 'created_at', 'updated_at'], 'integer'],
[['description', 'data'], 'string'],
[['name', 'rule_name'], 'string', 'max' => 64],
[['name'], 'unique'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'name' => 'Name',
'type' => 'Type',
'description' => 'Description',
'rule_name' => 'Rule Name',
'data' => 'Data',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
/**
* Gets query for [[AuthItemChildren]].
*
* @return \yii\db\ActiveQuery
*/
public function getAuthItemChildren()
{
return $this->hasMany(AuthItemChild::class, ['parent' => 'name']);
}
/**
* Gets query for [[AuthItemChildren0]].
*
* @return \yii\db\ActiveQuery
*/
public function getAuthItemChildren0()
{
return $this->hasMany(AuthItemChild::class, ['child' => 'name']);
}
/**
* Gets query for [[Children]].
*
* @return \yii\db\ActiveQuery
*/
public function getChildren()
{
return $this->hasMany(AuthItem::class, ['name' => 'child'])->viaTable('yii_auth_item_child', ['parent' => 'name']);
}
/**
* Gets query for [[Parents]].
*
* @return \yii\db\ActiveQuery
*/
public function getParents()
{
return $this->hasMany(AuthItem::class, ['name' => 'parent'])->viaTable('yii_auth_item_child', ['child' => 'name']);
}
}