Fixing bugs and improving.

Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
This commit is contained in:
Taylor Otwell
2012-03-16 15:32:26 -05:00
parent b5e75f6fcf
commit 762f2402c3
4 changed files with 26 additions and 6 deletions

View File

@@ -68,6 +68,19 @@ abstract class Relationship extends Query {
return strtolower(basename($model).'_id');
}
/**
* Get a freshly instantiated instance of the related model class.
*
* @param array $attributes
* @return Model
*/
protected function fresh_model($attributes = array())
{
$class = get_class($this->model);
return new $class($attributes);
}
/**
* Get the foreign key for the relationship.
*