mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-15 14:50:56 +08:00
31 lines
659 B
PHP
31 lines
659 B
PHP
<?php
|
|
/**
|
|
* @link http://www.yiiframework.com/
|
|
* @copyright Copyright (c) 2008 Yii Software LLC
|
|
* @license http://www.yiiframework.com/license/
|
|
*/
|
|
|
|
namespace yiiunit\data\base;
|
|
|
|
use yii\base\Model;
|
|
|
|
/**
|
|
* Singer.
|
|
*/
|
|
class Singer extends Model
|
|
{
|
|
public $firstName;
|
|
public $lastName;
|
|
public $test;
|
|
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['lastName'], 'default', 'value' => 'Lennon'],
|
|
[['lastName'], 'required'],
|
|
[['underscore_style'], 'yii\captcha\CaptchaValidator'],
|
|
[['test'], 'required', 'when' => function ($model) { return $model->firstName === 'cebe'; }],
|
|
];
|
|
}
|
|
}
|