commit | author | age
|
90c639
|
1 |
<?php |
Z |
2 |
|
|
3 |
namespace app\models; |
|
4 |
|
|
5 |
use Yii; |
|
6 |
|
|
7 |
/** |
|
8 |
* This is the model class for table "{{%plugin_cat}}". |
|
9 |
* |
|
10 |
* @property int $id |
|
11 |
* @property string $name |
|
12 |
* @property string $display_name |
|
13 |
* @property string $color |
|
14 |
* @property int $sort |
|
15 |
* @property string $icon |
|
16 |
* @property int $is_delete |
|
17 |
* @property string $add_time |
|
18 |
* @property string $update_time |
|
19 |
*/ |
|
20 |
class PluginCat extends ModelActiveRecord |
|
21 |
{ |
|
22 |
/** |
|
23 |
* {@inheritdoc} |
|
24 |
*/ |
|
25 |
public static function tableName() |
|
26 |
{ |
|
27 |
return '{{%plugin_cat}}'; |
|
28 |
} |
|
29 |
|
|
30 |
/** |
|
31 |
* {@inheritdoc} |
|
32 |
*/ |
|
33 |
public function rules() |
|
34 |
{ |
|
35 |
return [ |
|
36 |
[['name', 'display_name'], 'required'], |
|
37 |
[['sort', 'is_delete'], 'integer'], |
|
38 |
[['icon'], 'string'], |
|
39 |
[['add_time', 'update_time'], 'safe'], |
|
40 |
[['name', 'display_name'], 'string', 'max' => 255], |
|
41 |
[['color'], 'string', 'max' => 24], |
|
42 |
]; |
|
43 |
} |
|
44 |
|
|
45 |
/** |
|
46 |
* {@inheritdoc} |
|
47 |
*/ |
|
48 |
public function attributeLabels() |
|
49 |
{ |
|
50 |
return [ |
|
51 |
'id' => 'ID', |
|
52 |
'name' => 'Name', |
|
53 |
'display_name' => 'Display Name', |
|
54 |
'sort' => 'Sort', |
|
55 |
'icon' => 'Icon', |
|
56 |
'is_delete' => 'Is Delete', |
|
57 |
'created_at' => 'Created At', |
|
58 |
'updated_at' => 'Updated At', |
|
59 |
'deleted_at' => 'Deleted At', |
|
60 |
]; |
|
61 |
} |
|
62 |
|
|
63 |
public function getPlugins() |
|
64 |
{ |
|
65 |
return $this->hasMany(CorePlugin::class, [ |
|
66 |
'name' => 'plugin_name' |
|
67 |
])->via('pluginCatRels'); |
|
68 |
} |
|
69 |
|
|
70 |
public function getPluginCatRels() |
|
71 |
{ |
|
72 |
return $this->hasMany(PluginCatRel::class, [ |
|
73 |
'plugin_cat_name' => 'name', |
|
74 |
]); |
|
75 |
} |
|
76 |
} |