diff --git a/laravel/database/eloquent/relationships/relationship.php b/laravel/database/eloquent/relationships/relationship.php index 1fcdc5a4..1ce9f31b 100644 --- a/laravel/database/eloquent/relationships/relationship.php +++ b/laravel/database/eloquent/relationships/relationship.php @@ -62,7 +62,7 @@ public static function foreign($model, $foreign = null) // namespace, and we'll append "_id" to the name. if (is_object($model)) { - $model = get_class($model); + $model = class_basename($model); } return strtolower(basename($model).'_id'); @@ -88,7 +88,7 @@ protected function fresh_model($attributes = array()) */ protected function foreign_key() { - return Relationship::foreign($this->base, $this->foreign); + return static::foreign($this->base, $this->foreign); } } \ No newline at end of file diff --git a/laravel/helpers.php b/laravel/helpers.php index 68b68602..beff3446 100644 --- a/laravel/helpers.php +++ b/laravel/helpers.php @@ -388,7 +388,7 @@ function class_basename($class) { if (is_object($class)) $class = get_class($class); - return basename($class); + return basename(str_replace('\\', '/', $class)); } /**