diff --git a/HasCount.php b/HasCount.php index 2d4716d..5cccd39 100644 --- a/HasCount.php +++ b/HasCount.php @@ -16,15 +16,16 @@ class HasCount extends HasBase /** * @param $name * @param $arguments - * @return ActiveQuery - * @throws ActiveQuery|static + * @return static */ public function __call($name, $arguments) { if (!method_exists($this, $name)) { - return $this->_relation->getQuery($this->model::className())->$name(...$arguments); - } - return call_user_func([$this, $name], ...$arguments); + $this->_relation->getQuery($this->model::className())->$name(...$arguments); + } else { + call_user_func([$this, $name], ...$arguments); + } + return $this; } /** diff --git a/HasMany.php b/HasMany.php index 6f57332..75ea3a7 100644 --- a/HasMany.php +++ b/HasMany.php @@ -24,14 +24,16 @@ class HasMany extends HasBase /** * @param $name * @param $arguments - * @return ActiveQuery|static + * @return static */ public function __call($name, $arguments) { if (!method_exists($this, $name)) { - return $this->_relation->getQuery($this->model::className())->$name(...$arguments); - } - return call_user_func([$this, $name], ...$arguments); + $this->_relation->getQuery($this->model::className())->$name(...$arguments); + } else { + call_user_func([$this, $name], ...$arguments); + } + return $this; } /** diff --git a/HasOne.php b/HasOne.php index 3313d35..f1ebd42 100644 --- a/HasOne.php +++ b/HasOne.php @@ -23,14 +23,16 @@ class HasOne extends HasBase /** * @param $name * @param $arguments - * @return ActiveQuery|static + * @return static */ public function __call($name, $arguments) { if (!method_exists($this, $name)) { - return $this->_relation->getQuery($this->model::className())->$name(...$arguments); - } - return call_user_func([$this, $name], ...$arguments); + $this->_relation->getQuery($this->model::className())->$name(...$arguments); + } else { + call_user_func([$this, $name], ...$arguments); + } + return $this; } /**