update thống kê
This commit is contained in:
57
models/EventType.php
Normal file
57
models/EventType.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This is the model class for table "event_type".
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $code
|
||||
* @property string $name
|
||||
* @property string $description
|
||||
*/
|
||||
class EventType extends \yii\db\ActiveRecord {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function tableName() {
|
||||
return 'event_type';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules() {
|
||||
return [
|
||||
[['code', 'name', 'description'], 'required'],
|
||||
[['code'], 'integer'],
|
||||
[['description'], 'string'],
|
||||
[['name'], 'string', 'max' => 200],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function attributeLabels() {
|
||||
return [
|
||||
'id' => 'ID',
|
||||
'code' => 'Code',
|
||||
'name' => 'Name',
|
||||
'description' => 'Description',
|
||||
];
|
||||
}
|
||||
|
||||
public static function eventTypeArray() {
|
||||
$lists = self::find()->all();
|
||||
$results = [];
|
||||
foreach ($lists as $key => $value) {
|
||||
$results[$value->code] = $value->name;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user