diff --git a/Relation.php b/Relation.php index 80e2faa..38512ac 100644 --- a/Relation.php +++ b/Relation.php @@ -57,9 +57,7 @@ class Relation extends Component if (Context::exists($_identification)) { return Context::get($_identification); } - $activeModel = $this->_query[$_identification]->first(); - unset($this->_query[$_identification]); - return Context::set($_identification, $activeModel); + return Context::set($_identification, $this->_query[$_identification]->first()); } @@ -72,9 +70,7 @@ class Relation extends Component if (Context::exists($_identification)) { return Context::get($_identification); } - $activeModel = $this->_query[$_identification]->count(); - unset($this->_query[$_identification]); - return Context::set($_identification, $activeModel); + return Context::set($_identification, $this->_query[$_identification]->count()); } @@ -88,9 +84,7 @@ class Relation extends Component if (Context::exists($_identification)) { return Context::get($_identification); } - $activeModel = $this->_query[$_identification]->get(); - unset($this->_query[$_identification]); - return Context::set($_identification, $activeModel); + return Context::set($_identification, $this->_query[$_identification]->get()); } }