Fixing bugs in eloquent relating to namespaces.

This commit is contained in:
Taylor Otwell 2012-03-21 15:45:05 -05:00
parent 8457238ab1
commit 30204e082b
2 changed files with 3 additions and 3 deletions

View File

@ -62,7 +62,7 @@ public static function foreign($model, $foreign = null)
// namespace, and we'll append "_id" to the name. // namespace, and we'll append "_id" to the name.
if (is_object($model)) if (is_object($model))
{ {
$model = get_class($model); $model = class_basename($model);
} }
return strtolower(basename($model).'_id'); return strtolower(basename($model).'_id');
@ -88,7 +88,7 @@ protected function fresh_model($attributes = array())
*/ */
protected function foreign_key() protected function foreign_key()
{ {
return Relationship::foreign($this->base, $this->foreign); return static::foreign($this->base, $this->foreign);
} }
} }

View File

@ -388,7 +388,7 @@ function class_basename($class)
{ {
if (is_object($class)) $class = get_class($class); if (is_object($class)) $class = get_class($class);
return basename($class); return basename(str_replace('\\', '/', $class));
} }
/** /**