54 lines
1.0 KiB
PHP
54 lines
1.0 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: zn
|
|
* Date: 2017/6/21
|
|
* Time: 17:22
|
|
*/
|
|
|
|
namespace common\models;
|
|
|
|
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\ActiveRecord;
|
|
|
|
/**
|
|
* 公告
|
|
* Class Notice
|
|
* @property int $id
|
|
* @property string $title 标题
|
|
* @property string $message
|
|
* @property integer $created_at
|
|
* @property integer $updated_at
|
|
*/
|
|
class Notice extends ActiveRecord
|
|
{
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
TimestampBehavior::className(),
|
|
];
|
|
}
|
|
|
|
public function rules()
|
|
{
|
|
return [
|
|
['id', 'default', 'value' => 0],
|
|
|
|
['title', 'default', 'value' => ''],
|
|
['title', 'string', 'max' => 50],
|
|
|
|
['message', 'default', 'value' => ''],
|
|
['message', 'string', 'max' => 1000],
|
|
|
|
['created_at', 'default', 'value' => 0],
|
|
['updated_at', 'default', 'value' => 0],
|
|
];
|
|
}
|
|
|
|
public static function findByID($id)
|
|
{
|
|
return self::findOne(['id' => $id]);
|
|
}
|
|
|
|
} |