Article.php
1.86 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
85
86
87
88
89
<?php
namespace thread\modules\faq\models;
use Yii;
//
use thread\app\base\models\ActiveRecord;
use thread\modules\faq\Faq as ParentModule;
/**
* Class Article
*
* @package thread\modules\faq\models
* @author FilamentV <vortex.filament@gmail.com>
* @copyright (c), Thread
*/
class Article extends ActiveRecord
{
/**
* @return null|object|string
*/
public static function getDb()
{
return ParentModule::getDb();
}
/**
* @return string
*/
public static function tableName()
{
return '{{%faq_article}}';
}
/**
* @return array
*/
public function rules()
{
return [
[['group_id', 'create_time', 'update_time'], 'integer'],
[['published', 'deleted'], 'in', 'range' => array_keys(static::statusKeyRange())],
];
}
/**
* @return array
*/
public function scenarios()
{
return [
'published' => ['published'],
'deleted' => ['deleted'],
'backend' => ['group_id', 'published', 'deleted'],
];
}
/**
* @return array
*/
public function attributeLabels()
{
return [
'id' => Yii::t('app', 'ID'),
'group_id' => Yii::t('app', 'Group'),
'created_at' => Yii::t('app', 'Create time'),
'updated_at' => Yii::t('app', 'Update time'),
'published' => Yii::t('app', 'Published'),
'deleted' => Yii::t('app', 'Deleted'),
'title' => Yii::t('app', 'Title'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getGroup()
{
return $this->hasOne(Group::class, ['id' => 'group_id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getLang()
{
return $this->hasOne(ArticleLang::class, ['rid' => 'id']);
}
}