From f2f1d4d17301cde3cb62ea1f5b4cbf6ba8172f10 Mon Sep 17 00:00:00 2001 From: Pavel Puchkin Date: Wed, 8 May 2013 20:11:44 +1000 Subject: [PATCH] Return `$this` in `set_attribute` --- laravel/database/eloquent/model.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index b35fb1a2..6c0ef483 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -441,7 +441,7 @@ abstract class Model { } /** - *Updates the timestamp on the model and immediately saves it. + * Updates the timestamp on the model and immediately saves it. * * @return void */ @@ -562,11 +562,12 @@ abstract class Model { * * @param string $key * @param mixed $value - * @return void + * @return Model */ public function set_attribute($key, $value) { $this->attributes[$key] = $value; + return $this; } /** @@ -769,8 +770,7 @@ abstract class Model { } elseif (starts_with($method, 'set_')) { - $this->set_attribute(substr($method, 4), $parameters[0]); - return $this; + return $this->set_attribute(substr($method, 4), $parameters[0]); } // Finally we will assume that the method is actually the beginning of a