/** * Logs in the user using the given username and password in the model. * @return boolean whether login is successful */ public function signup() { $user = Band::model()->findByAttributes(array('name_band' => $this->name)); //create model in the models folder if ($user != null) { // user already exist $this->addError('name', 'This name already exists'); return false; } else { if ($this->name == null) { $this->addError('name', 'Name cannot be blank'); return false; } else { if ($this->password == null) { $this->addError('password', 'Password cannot be blank'); return false; } else { if ($this->genre == null) { $this->addError('genre', 'Genre cannot be blank'); return false; } } } } $_band = new Band(); $_band->page_band = $this->page; $_band->name_band = $this->name; $_band->password_band = $this->password; $_band->genre_band = $this->genre; $_band->email_band = $this->email; $_band->desc_band = $this->desc; $_band->save(); return true; }
public function signup() { $user = new Band(); $user->name_band = $this->username; $user->code_band = $this->password; $user->save(); ///return !$this->errorCode; }