From ab2fcb84ef1af5e72e9da8b18d6193053a295dd0 Mon Sep 17 00:00:00 2001 From: Jason Lewis Date: Sun, 3 Jun 2012 19:23:35 +0930 Subject: [PATCH] Possible fix for issue #378. Signed-off-by: Jason Lewis --- laravel/database/eloquent/model.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 91aedd6e..a6a32780 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -230,11 +230,9 @@ abstract class Model { * @param array $columns * @return Model */ - public static function find($id, $columns = array('*')) + public function _find($id, $columns = array('*')) { - $model = new static; - - return $model->query()->where(static::$key, '=', $id)->first($columns); + return $this->query()->where(static::$key, '=', $id)->first($columns); } /** @@ -749,7 +747,7 @@ abstract class Model { // Some methods need to be accessed both staticly and non-staticly so we'll // keep underscored methods of those methods and intercept calls to them // here so they can be called either way on the model instance. - if (in_array($method, array('with'))) + if (in_array($method, array('with', 'find'))) { return call_user_func_array(array($this, '_'.$method), $parameters); }