Created
June 19, 2012 13:52
-
-
Save dkobia/2954346 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Overload saving to perform additional functions on the account | |
*/ | |
public function save(Validation $validation = NULL) | |
{ | |
// Do this for first time items only | |
if ($this->loaded() === FALSE) | |
{ | |
// Save the original creator of this account | |
// Logged In User | |
$user = Auth::instance()->get_user(); | |
if ($user) | |
{ | |
$this->user_id = $user->id; | |
} | |
// Save the date the feed was first added | |
$this->account_date_add = date("Y-m-d H:i:s", time()); | |
} | |
else | |
{ | |
$this->account_date_modified = date("Y-m-d H:i:s", time()); | |
} | |
return parent::save(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment