'\common\models\Author', 'message' => 'Такой email уже существует', ], ]; } /** * Signs user up. * * @return Author|null the saved model or null if saving fails */ public function signup() { if (!$this->validate()) { return null; } $user = new Author(); $user->name = $this->name; $user->secondname = $this->secondname; $user->email = $this->email; $user->phone = $this->phone; $user->setPassword($this->password); $user->generateAuthKey(); $user->status = Author::STATUS_ACTIVE; return $user->save() ? $user : null; } }