You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.1 KiB
56 lines
1.1 KiB
5 years ago
|
<?php
|
||
|
|
||
|
namespace common\models;
|
||
|
|
||
|
use Yii;
|
||
|
|
||
|
/**
|
||
|
* This is the model class for table "power_menu_t".
|
||
|
*
|
||
|
* @property integer $power_id
|
||
|
* @property integer $menu_id
|
||
|
*/
|
||
|
class PowerMenuT extends \common\models\Base
|
||
|
{
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public static function tableName()
|
||
|
{
|
||
|
return 'power_menu_t';
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public function rules()
|
||
|
{
|
||
|
return [
|
||
|
[['power_id', 'menu_id'], 'required'],
|
||
|
[['power_id', 'menu_id'], 'integer'],
|
||
|
[['power_id', 'menu_id'], 'unique', 'targetAttribute' => ['power_id', 'menu_id'], 'message' => 'The combination of Power ID and Menu ID has already been taken.'],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public function attributeLabels()
|
||
|
{
|
||
|
return [
|
||
|
'power_id' => 'Power ID',
|
||
|
'menu_id' => 'Menu ID',
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function getMenus()
|
||
|
{
|
||
|
return $this->hasOne(MenuT::className(),['id'=>'menu_id']);
|
||
|
}
|
||
|
|
||
|
public function getPower()
|
||
|
{
|
||
|
return $this->hasOne(PowerT::className(),['id'=>'power_id']);
|
||
|
}
|
||
|
}
|