3
我的模型規則是這樣的如何在Yii2中定義場景?
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]
];
}
,同時創建一個新用戶,我需要需要電子郵件地址和密碼,但更新過程中,我需要只需要用戶名。我怎樣才能做到這一點?