我的模型规则是这样的
public function rules()
{
return [
[['email','password'], 'required'],
[['email'],'unique'],
[['status','role_id','created_by', 'updated_by', 'is_deleted'], 'integer'],
[['created_at', 'updated_at'], 'safe'],
[['first_name', 'last_name', 'email', 'username','location','address','about_me'], 'string', 'max' => 200],
[['phone'], 'string', 'max' => 100]
];
}
创建新用户时,我需要电子邮件和密码,但在更新期间,我只需要用户名。我怎样才能做到这一点?