From 17727a2278e79f3d7e8436e81a2acc157d4652cf Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Sat, 13 Aug 2011 20:01:45 -0500 Subject: [PATCH] rename eloquent::model to eloquent::model_name --- system/auth.php | 10 +++++----- system/db/eloquent/model.php | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/system/auth.php b/system/auth.php index 22624dfd..21a32dd6 100644 --- a/system/auth.php +++ b/system/auth.php @@ -79,7 +79,7 @@ class Auth { * by the Hash class when authenticating. * * - * if (Auth::attempt('test@gmail.com', 'secret')) + * if (Auth::login('test@gmail.com', 'secret')) * { * // The credentials are valid... * } @@ -90,13 +90,13 @@ class Auth { * @return bool * @see Hash::check() */ - public static function attempt($username, $password) + public static function login($username, $password) { if ( ! is_null($user = call_user_func(Config::get('auth.by_username'), $username))) { if (Hash::check($password, $user->password)) { - static::login($user); + static::remember($user); return true; } @@ -106,7 +106,7 @@ class Auth { } /** - * Login a given user into the application. + * Log a user into the application without checking credentials. * * The user's ID will be stored in the session and the user will be considered * "logged in" on subsequent requests to the application. @@ -116,7 +116,7 @@ class Auth { * @param object $user * @return void */ - public static function login($user) + public static function remember($user) { static::$user = $user; diff --git a/system/db/eloquent/model.php b/system/db/eloquent/model.php index f00d0392..311b5d61 100644 --- a/system/db/eloquent/model.php +++ b/system/db/eloquent/model.php @@ -150,7 +150,7 @@ abstract class Model { { if (property_exists($class, 'table')) return $class::$table; - return strtolower(Inflector::plural(static::model($class))); + return strtolower(Inflector::plural(static::model_name($class))); } /** @@ -159,7 +159,7 @@ abstract class Model { * @param string|Model $model * @return string */ - public static function model($model) + public static function model_name($model) { $class = (is_object($model)) ? get_class($model) : $model; @@ -268,7 +268,7 @@ abstract class Model { */ private function has_one_or_many($model, $foreign_key) { - $this->relating_key = (is_null($foreign_key)) ? strtolower(static::model($this)).'_id' : $foreign_key; + $this->relating_key = (is_null($foreign_key)) ? strtolower(static::model_name($this)).'_id' : $foreign_key; return static::query($model)->where($this->relating_key, '=', $this->id); } @@ -322,11 +322,11 @@ abstract class Model { // Allowing the overriding of the foreign and associated keys provides the flexibility for // self-referential many-to-many relationships, such as a "buddy list". - $this->relating_key = (is_null($foreign_key)) ? strtolower(static::model($this)).'_id' : $foreign_key; + $this->relating_key = (is_null($foreign_key)) ? strtolower(static::model_name($this)).'_id' : $foreign_key; // The associated key is the foreign key name of the related model. So, if the related model // is "Role", the associated key on the intermediate table would be "role_id". - $associated_key = (is_null($associated_key)) ? strtolower(static::model($model)).'_id' : $associated_key; + $associated_key = (is_null($associated_key)) ? strtolower(static::model_name($model)).'_id' : $associated_key; return static::query($model) ->select(array(static::table($model).'.*')) @@ -345,7 +345,7 @@ abstract class Model { */ private function intermediate_table($model) { - $models = array(Inflector::plural(static::model($model)), Inflector::plural(static::model($this))); + $models = array(Inflector::plural(static::model_name($model)), Inflector::plural(static::model_name($this))); sort($models);