public function save()
{
$query = $this->newQueryWithDeleted();
// If the "saving" event returns false we'll bail out of the save and return
// false, indicating that the save failed. This gives an opportunities to
// listeners to cancel save operations if validations fail or whatever.
if ($this->fireModelEvent('saving') === false) {
return false;
}
// If the model already exists in the database we can just update our record
// that is already in this database using the current IDs in this "where"
// clause to only update this model. Otherwise, we'll just insert them.
if ($this->exists) {
$saved = $this->performUpdate($query);
} else {
$saved = $this->performInsert($query);
}
if ($saved) {
$this->finishSave();
}
return $saved;
}