Singer.php 511 Bytes
Newer Older
Alexander Makarov committed
1 2
<?php
namespace yiiunit\data\base;
Alexander Makarov committed
3

Alexander Makarov committed
4 5 6 7 8 9 10
use yii\base\Model;

/**
 * Singer
 */
class Singer extends Model
{
11
    public $firstName;
12
    public $lastName;
13
    public $test;
Alexander Makarov committed
14

15 16 17 18 19 20
    public function rules()
    {
        return [
            [['lastName'], 'default', 'value' => 'Lennon'],
            [['lastName'], 'required'],
            [['underscore_style'], 'yii\captcha\CaptchaValidator'],
21
            [['test'], 'required', 'when' => function($model) { return $model->firstName === 'cebe'; }],
22 23
        ];
    }
Zander Baldwin committed
24
}