Fixing bugs… adding better pivot support.

Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
This commit is contained in:
Taylor Otwell
2012-03-16 11:29:21 -05:00
parent c9c0ddf569
commit c3d95122e4
4 changed files with 129 additions and 17 deletions

View File

@@ -345,6 +345,18 @@ abstract class Model {
return new Query($this);
}
/**
* Sync the original attributes with the current attributes.
*
* @return bool
*/
final public function sync()
{
$this->original = $this->attributes;
return true;
}
/**
* Determine if a given attribute has changed from its original state.
*
@@ -421,6 +433,18 @@ abstract class Model {
$this->attributes[$key] = $value;
}
/**
* Remove an attribute from the model.
*
* @param string $key
*/
final public function purge($key)
{
unset($this->original[$key]);
unset($this->attributes[$key]);
}
/**
* Handle the dynamic retrieval of attributes and associations.
*