Revert "改名"

This reverts commit fdf58326
This commit is contained in:
2022-01-19 14:59:46 +08:00
parent d42fc588b4
commit b10ffd832a
3 changed files with 12 additions and 12 deletions
+4 -4
View File
@@ -3,8 +3,8 @@ declare(strict_types=1);
namespace Database; namespace Database;
use Exception;
use Database\Traits\HasBase; use Database\Traits\HasBase;
use Exception;
/** /**
* Class HasCount * Class HasCount
@@ -21,11 +21,11 @@ class HasCount extends HasBase
*/ */
public function __call($name, $arguments) public function __call($name, $arguments)
{ {
if (method_exists($this, $name)) { if (!method_exists($this, $name)) {
return call_user_func([$this, $name], ...$arguments);
}
return $this->_relation->getQuery($this->model::className())->$name(...$arguments); return $this->_relation->getQuery($this->model::className())->$name(...$arguments);
} }
return call_user_func([$this, $name], ...$arguments);
}
/** /**
* @return array|null|ModelInterface * @return array|null|ModelInterface
+5 -4
View File
@@ -6,10 +6,11 @@
* Time: 13:58 * Time: 13:58
*/ */
declare(strict_types=1); declare(strict_types=1);
namespace Database; namespace Database;
use Exception;
use Database\Traits\HasBase; use Database\Traits\HasBase;
use Exception;
/** /**
* Class HasMany * Class HasMany
@@ -27,11 +28,11 @@ class HasMany extends HasBase
*/ */
public function __call($name, $arguments) public function __call($name, $arguments)
{ {
if (method_exists($this, $name)) { if (!method_exists($this, $name)) {
return call_user_func([$this, $name], ...$arguments);
}
return $this->_relation->getQuery($this->model::className())->$name(...$arguments); return $this->_relation->getQuery($this->model::className())->$name(...$arguments);
} }
return call_user_func([$this, $name], ...$arguments);
}
/** /**
* @return array|null|ModelInterface * @return array|null|ModelInterface
+3 -4
View File
@@ -27,11 +27,10 @@ class HasOne extends HasBase
*/ */
public function __call($name, $arguments) public function __call($name, $arguments)
{ {
if (method_exists($this, $name)) { if (!method_exists($this, $name)) {
return call_user_func([$this, $name], ...$arguments); return $this->_relation->getQuery($this->model::className())->$name(...$arguments);
} }
$this->_relation->getQuery($this->model::className())->$name(...$arguments); return call_user_func([$this, $name], ...$arguments);
return $this;
} }
/** /**