This commit is contained in:
xl
2024-10-23 14:51:09 +08:00
parent 59375e567e
commit 8027effa8c
+3 -9
View File
@@ -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());
}
}