title: Yii 2 signup does not save records
body: <p>In first, sorry for my bad English, I am little bit tried... 
  My problem is that, when iI want to create a new user everything goes well, but ActiveRecord does not save my new account. </p>
  
  <p>This is my first question.. don't realy know what to paste in here... But:</p>
  
  <p>Here is My signup view:</p>
  
  <pre><code>&lt;?php
  
  /* @var $this yii\web\View */
  /* @var $form yii\bootstrap\ActiveForm */
  /* @var $model \frontend\models\SignupForm */
  
  use yii\helpers\Html;
  use yii\bootstrap\ActiveForm;
  
  $this-&gt;title = 'Signup';
  $this-&gt;params['breadcrumbs'][] = $this-&gt;title;
  ?&gt;
  
  &lt;div class="site-signup"&gt;
      &lt;h1&gt;&lt;?= Html::encode($this-&gt;title) ?&gt;&lt;/h1&gt;
  
      &lt;p&gt;Please fill these forms with the correct informations:&lt;/p&gt;
  
      &lt;div class="row"&gt;
          &lt;div class="col-lg-5"&gt;
              &lt;?php $form = ActiveForm::begin(['id' =&gt; 'form-signup']); ?&gt;
  
                 &lt;?= $form-&gt;field($model, 'firstname')-&gt;textInput() ?&gt;
                 &lt;?= $form-&gt;field($model, 'lastname')-&gt;textInput() ?&gt;
                 &lt;?= $form-&gt;field($model, 'email')-&gt;textInput(['autofocus' =&gt; true]) ?&gt;
                 &lt;?= $form-&gt;field($model, 'username')-&gt;textInput() ?&gt;
  
                 &lt;?= $form-&gt;field($model, 'password')-&gt;passwordInput() ?&gt;
  
                  &lt;div class="form-group"&gt;
                      &lt;?= Html::submitButton('Signup', ['class' =&gt; 'btn btn-primary', 'name' =&gt; 'signup-button']) ?&gt;
                  &lt;/div&gt;
  
              &lt;?php ActiveForm::end(); ?&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is the signupForm model:</p>
  
  <pre><code>&lt;?php
  namespace frontend\models;
  
  use yii\base\Model;
  use common\models\User;
  
  /**
   * Signup form
   */
  class SignupForm extends Model
  {
      public $username;
      public $firstname;
      public $lastname;
      public $email;
      public $password;
  
  
      /**
       * @inheritdoc
       */
      public function rules()
      {
          return [
  
              ['firstname', 'required', 'message'=&gt;'You need to fill this'],
              ['firstname','string', 'min'=&gt; 1, 'max'=&gt;30],
              ['lastname', 'required', 'message'=&gt;'You need to fill this'],
              ['lastname','string', 'min'=&gt; 1, 'max'=&gt;30],
  
              ['username', 'trim'],
              ['username', 'required'],
              ['username', 'unique', 'targetClass' =&gt; '\common\models\User', 'message' =&gt; 'This username has already been taken.'],
              ['username', 'string', 'min' =&gt; 2, 'max' =&gt; 255],
  
              ['email', 'trim'],
              ['email', 'required'],
              ['email', 'email'],
              ['email', 'string', 'max' =&gt; 255],
              ['email', 'unique', 'targetClass' =&gt; '\common\models\User', 'message' =&gt; 'This email address has already been taken.'],
  
              ['password', 'required'],
              ['password', 'string', 'min' =&gt; 6],
          ];
      }
  
      /**
       * Signs user up.
       *
       * @return User|null the saved model or null if saving fails
       */
      public function signup()
      {
          if (!$this-&gt;validate()) {
  
          $user = new User();
          $user-&gt;firstname = $this-&gt;firstname;
          $user-&gt;lastname = $this-&gt;lastname;
          $user-&gt;username = $this-&gt;username;
          $user-&gt;email = $this-&gt;email;
          $user-&gt;setPassword($this-&gt;password);
          $user-&gt;generateAuthKey();
          $user-&gt;save();
          return $user;
      }
          return null;
      }
  
  
  
      public function sendEmail(){   
          $user = User::findOne([
          'status_id' =&gt; User::STATUS_ACTIVE,
          'email' =&gt; $this-&gt;email,
          ]);
          if ($user) {
          $user-&gt;generatePasswordResetToken();
          if ($user-&gt;save()) {
          return Yii::$app-&gt;mailer-&gt;compose('passwordResetToken',
          ['user' =&gt; $user])
          -&gt;setFrom([\Yii::$app-&gt;params['supportEmail'] =&gt; Yii::$app-&gt;name . ' robot'])
          -&gt;setTo($this-&gt;email)
          -&gt;setSubject('Password reset for ' . Yii::$app-&gt;name)
          -&gt;send();
              }
          }
      return false;
  
      }
  }
  </code></pre>
  
  <p>And the controller: </p>
  
  <pre><code>&lt;?php
  namespace frontend\controllers;
  
  use Yii;
  use yii\base\InvalidParamException;
  use yii\web\BadRequestHttpException;
  use yii\web\Controller;
  use yii\filters\VerbFilter;
  use yii\filters\AccessControl;
  use common\models\LoginForm;
  use frontend\models\PasswordResetRequestForm;
  use frontend\models\ResetPasswordForm;
  use frontend\models\SignupForm;
  use frontend\models\ContactForm;
  /**
   * Site controller
   */
  class SiteController extends Controller
  {
      /**
       * @inheritdoc
       */
      public function behaviors()
      {
          return [
              'access' =&gt; [
                  'class' =&gt; AccessControl::className(),
                  'only' =&gt; ['logout', 'signup'],
                  'rules' =&gt; [
                      [
                          'actions' =&gt; ['signup'],
                          'allow' =&gt; true,
                          'roles' =&gt; ['?'],
                      ],
                      [
                          'actions' =&gt; ['logout'],
                          'allow' =&gt; true,
                          'roles' =&gt; ['@'],
                      ],
                  ],
              ],
              'verbs' =&gt; [
                  'class' =&gt; VerbFilter::className(),
                  'actions' =&gt; [
                      'logout' =&gt; ['post'],
                  ],
              ],
          ];
      }
  
      /**
       * @inheritdoc
       */
      public function actions()
      {
          return [
              'error' =&gt; [
                  'class' =&gt; 'yii\web\ErrorAction',
              ],
              'captcha' =&gt; [
                  'class' =&gt; 'yii\captcha\CaptchaAction',
                  'fixedVerifyCode' =&gt; YII_ENV_TEST ? 'testme' : null,
              ],
          ];
      }
  
      /**
       * Displays homepage.
       *
       * @return mixed
       */
      public function actionIndex()
      {
          return $this-&gt;render('index');
          $name = Yii::$app-&gt;user-&gt;identity-&gt;username;
          return $this-&gt;render('index',['name' =&gt; $name]);
      }
  
      /**
       * Logs in a user.
       *
       * @return mixed
       */
      public function actionLogin()
      {
          $this-&gt;layout ='login';
          if (!Yii::$app-&gt;user-&gt;isGuest) {
              return $this-&gt;goHome();
          }
  
          $model = new LoginForm();
          if ($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; $model-&gt;login()) {
              return $this-&gt;redirect('?r=site%2Fhome');;
          } else {
              return $this-&gt;render('login', [
                  'model' =&gt; $model,
              ]);
          }
      }
  
      /**
       * Logs out the current user.
       *
       * @return mixed
       */
      public function actionLogout()
      {
          Yii::$app-&gt;user-&gt;logout();
  
          return $this-&gt;goHome();
      }
  
      /**
       * Displays contact page.
       *
       * @return mixed
       */
      public function actionContact()
      {
          $model = new ContactForm();
  
          if ($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; $model-&gt;validate()) {
              if ($model-&gt;sendEmail(Yii::$app-&gt;params['adminEmail']))
              {
                  Yii::$app-&gt;session-&gt;setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
              } else {
                  Yii::$app-&gt;session-&gt;setFlash('error', 'There was an error sending your message.');
              }
  
              return $this-&gt;refresh();
          } else {
              return $this-&gt;render('contact', [
                  'model' =&gt; $model,
              ]);
          }
      }
  
      /**
       * Displays about page.
       *
       * @return mixed
       */
      public function actionAbout()
      {
          return $this-&gt;render('about');
      }
  
      /**
       * Signs user up.
       *
       * @return mixed
       */
      public function actionSignup(){
          $model = new SignupForm();
              if ($model-&gt;load(Yii::$app-&gt;request-&gt;post())) {
                  if ($user = $model-&gt;signup()) {
                      if (Yii::$app-&gt;getUser()-&gt;login($user)) {
                          return $this-&gt;goHome();
                      }
                  }
              }
          return $this-&gt;render('signup', ['model' =&gt; $model,]);
      }
  
      /**
       * Requests password reset.
       *
       * @return mixed
       */
      public function actionRequestPasswordReset()
      {
          $model = new PasswordResetRequestForm();
          if ($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; $model-&gt;validate()) {
              if ($model-&gt;sendEmail()) {
                  Yii::$app-&gt;session-&gt;setFlash('success', 'Check your email for further instructions.');
  
                  return $this-&gt;goHome();
              } else {
                  Yii::$app-&gt;session-&gt;setFlash('error', 'Sorry, we are unable to reset password for the provided email address.');
              }
          }
  
          return $this-&gt;render('requestPasswordResetToken', [
              'model' =&gt; $model,
          ]);
      }
  
      /**
       * Resets password.
       *
       * @param string $token
       * @return mixed
       * @throws BadRequestHttpException
       */
      public function actionResetPassword($token)
      {
          try {
              $model = new ResetPasswordForm($token);
          } catch (InvalidParamException $e) {
              throw new BadRequestHttpException($e-&gt;getMessage());
          }
  
          if ($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; $model-&gt;validate() &amp;&amp; $model-&gt;resetPassword()) {
              Yii::$app-&gt;session-&gt;setFlash('success', 'New password saved.');
  
              return $this-&gt;goHome();
          }
  
          return $this-&gt;render('resetPassword', [
              'model' =&gt; $model,
          ]);
      }
  }
  </code></pre>
  
  <p>And if you don't mind i have one more question... 
  How can I make and index page like this? ... I can't call anything into the index file.</p>
  
  <p><a href="https://imgur.com/kkEJT3Q" rel="nofollow noreferrer">https://imgur.com/kkEJT3Q</a> </p>
  
  <p>I created something what i want to saw. </p>
  
  <p>And somebody can link an explanition how to make " list " page for every registred user? </p>
  
  <p>Thank you very much guys..
  I know it's pretty much, but I am tilted.</p>