This commit is contained in:
xl
2024-11-06 20:36:59 +08:00
parent 32164f66ab
commit 28beb3678e
+6 -1
View File
@@ -52,12 +52,17 @@ abstract class HasBase implements \Database\Traits\Relation
* @param string $name
* @param array $arguments
* @return $this|mixed
* @throws \Exception
*/
public function __call(string $name, array $arguments)
{
if ($name !== 'get') {
$relation = Kiri::getDi()->get(Relation::class);
$relation->getQuery($this->name)->$name(...$arguments);
$query = $relation->getQuery($this->name);
if (is_null($query)) {
throw new \Exception('Unknown relation method: ' . $name);
}
$query->$name(...$arguments);
return $this;
} else {
return $this->get();