2021-07-09 11:53:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace yiiunit\extensions\bootstrap5\data;
|
|
|
|
|
|
|
|
use yii\base\Model;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Singer
|
|
|
|
*
|
|
|
|
* @author Daniel Gomez Pan <pana_1990@hotmail.com>
|
|
|
|
*/
|
|
|
|
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'],
|
2021-08-04 08:21:51 +02:00
|
|
|
[['test'], 'required', 'when' => function ($model) {
|
|
|
|
return $model->firstName === 'cebe';
|
|
|
|
}],
|
2021-07-09 11:53:24 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|