save() public method

Saves the current object. Will hash password if it was changed.
public save ( ) : ORM
return ORM
Esempio n. 1
0
 public function save(Validation $validation = NULL)
 {
     if (!$this->loaded()) {
         $this->created = time();
     }
     return parent::save($validation);
 }
 public function save(Validation $validation = NULL)
 {
     if (!$this->loaded()) {
         $this->date_created = DB::expr('NOW()');
     }
     $this->date_updated = DB::expr('NOW()');
     return parent::save($validation);
 }
Esempio n. 3
0
 /**
  * Overload saving to perform additional functions
  */
 public function save(Validation $validation = NULL)
 {
     // Do this for first time items only
     if ($this->loaded() === FALSE) {
         // Generate an api token
         $this->api_key = Text::random('alnum', 32);
         $this->api_key = hash_hmac('sha256', Text::random('alnum', 32), $this->email);
     }
     $user = parent::save();
     return $user;
 }
Esempio n. 4
0
 public function save()
 {
     $result = parent::save();
     // if this user has a new email we send an email to confirm
     if ($this->new_email) {
         $this->email_verified = 'False';
         $this->sendConfirmEmail();
     }
     // make sure the user has the login role
     $login_role = new Model_Role(array('name' => 'login'));
     if (!$this->has('roles', $login_role)) {
         $this->add('roles', $login_role);
     }
     return $result;
 }
Esempio n. 5
0
 public function save(validation $val = null)
 {
     if ($this->created == 0) {
         $this->created = time();
     }
     return parent::save($val);
 }