From a87bb869992d6050855b8c4d47f73b98567f4c56 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 29 Jun 2012 20:56:32 +0300 Subject: [PATCH] Fix a bug with Eloquent model classes and isset() when eager loading a relationship returns an empty result set. --- laravel/database/eloquent/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 2ad1c72b..7e9b0ba3 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -725,7 +725,7 @@ public function __isset($key) { foreach (array('attributes', 'relationships') as $source) { - if (array_key_exists($key, $this->$source)) return true; + if (array_key_exists($key, $this->$source)) return !is_null($this->$source[$key]); } if (method_exists($this, $key)) return true;