|
|
@ -1,26 +1,24 @@ |
|
|
|
<?php |
|
|
|
namespace Wiggins\MyProject; |
|
|
|
namespace Wiggins\MyProject\Models; |
|
|
|
|
|
|
|
use yii\base\Model; |
|
|
|
|
|
|
|
/** |
|
|
|
* 说明:用户注册或登录场景模型 |
|
|
|
* 属性: |
|
|
|
* @name string 用户名 |
|
|
|
* @eamil string 用户邮箱 |
|
|
|
* @password string 用户密码 |
|
|
|
* @pwdConfirm string 确认密码 |
|
|
|
*/ |
|
|
|
class UserInput extends Model |
|
|
|
{ |
|
|
|
/** |
|
|
|
|
|
|
|
public $name; //@var string 姓名
|
|
|
|
public $email; //@var string 邮箱
|
|
|
|
public $password; //@var string 密码
|
|
|
|
public $pwdConfirm; //@var string 确认密码
|
|
|
|
|
|
|
|
/** |
|
|
|
* @scenario 登陆场景 |
|
|
|
*/ |
|
|
|
public $name; |
|
|
|
public $email; |
|
|
|
public $password; |
|
|
|
public $pwdConfirm; |
|
|
|
|
|
|
|
const SCENARIO_LOGIN = 'login'; |
|
|
|
/** |
|
|
|
* @scenario 注册场景 |
|
|
|
*/ |
|
|
|
const SCENARIO_REGISTER = 'register'; |
|
|
|
|
|
|
|
|
|
|
|
public function attributeLabels() |
|
|
@ -36,8 +34,8 @@ |
|
|
|
public function scenarios() |
|
|
|
{ |
|
|
|
return[ |
|
|
|
'login' => ['name','password'], |
|
|
|
'register' => ['name','email','password','pwdConfirm'], |
|
|
|
self::SCENARIO_LOGIN => ['name','password'], |
|
|
|
self::SCENARIO_REGISTER => ['name','email','password','pwdConfirm'], |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
@ -61,4 +59,4 @@ |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
?>
|
|
|
|
?>
|