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
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-4
* Time: 上午10:22
*/
namespace backend\models\coin;
use yii\base\Model;
class NoticeForm extends Model
{
public $id;
public $title;
public $author;
public $content;
public $status;
public function formName()
{
return '';
}
public function rules()
{
return [
[['title', 'content', 'author'], 'required', 'on' => 'add'],
[['id', 'title', 'content', 'author'], 'required', 'on' => 'edit'],
];
}
public function scenarios()
{
return [
'add' => ['title', 'content', 'status', 'author'],
'edit' => ['id', 'title', 'content', 'status', 'author'],
];
}
}