Signup.php model code
public function rules() { return[ [['email', 'password'], 'required'], ['email', 'email'], ['email', 'unique', 'targetClass' => 'app\Models\User'], ['password', 'string', 'min' => 2, 'max' => 10] ]; } public function signup() { $user = new User(); $user->email = $this->email; $user->password = $this->password; return $user->save(); } }
Controller code
if (isset($_POST['Signup'])) { $model->attributes = Yii::$app->request->post('Signup'); if ($model->validate() && $model->signup()) { return $this->goHome(); } } return $this->render('signup', ['model'=>$model]); } And view
$ form = ActiveForm :: begin (['class' => 'form-horizontal']);
$ form-> field ($ model, 'email') -> textInput (['autofocus' => true]);
$ form-> field ($ model, 'password') -> passwordInput ();
Register
ActiveForm :: end ();
But the error itself:

modelsneed a small letter? or not written at alluse app\models\User;above - Alexey Shimanskyuseis in the class ofSignup? - Alexey Shimansky