Skip to content

Instantly share code, notes, and snippets.

@dkobia
Created June 19, 2012 13:52
Show Gist options
  • Save dkobia/2954346 to your computer and use it in GitHub Desktop.
Save dkobia/2954346 to your computer and use it in GitHub Desktop.
<?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