This commit is contained in:
2021-01-16 16:57:35 +08:00
parent b9dbba1dd5
commit eb622b8527
3 changed files with 19 additions and 14 deletions
+7 -5
View File
@@ -6,6 +6,7 @@
* Time: 13:47
*/
declare(strict_types=1);
namespace Database;
use Exception;
@@ -21,13 +22,14 @@ class HasOne extends HasBase
/**
* @param $name
* @param $arguments
* @return $this
* @throws Exception
* @return ActiveQuery
*/
public function __call($name, $arguments): static
public function __call($name, $arguments): mixed
{
$this->_relation->getQuery($this->model::className())->$name(...$arguments);
return $this;
if (method_exists($this, $name)) {
return call_user_func([$this, $name], ...$arguments);
}
return $this->_relation->getQuery($this->model::className())->$name(...$arguments);
}
/**