This commit is contained in:
2022-01-09 03:49:51 +08:00
parent a45d71d760
commit 2109ed7667
55 changed files with 7278 additions and 7278 deletions
+39 -39
View File
@@ -1,39 +1,39 @@
<?php
declare(strict_types=1);
namespace Database;
use Exception;
use Database\Traits\HasBase;
/**
* Class HasCount
* @package Database
*/
class HasCount extends HasBase
{
/**
* @param $name
* @param $arguments
* @return ActiveQuery
* @throws Exception
*/
public function __call($name, $arguments): mixed
{
if (method_exists($this, $name)) {
return call_user_func([$this, $name], ...$arguments);
}
return $this->_relation->getQuery($this->model::className())->$name(...$arguments);
}
/**
* @return array|null|ModelInterface
* @throws Exception
*/
public function get(): array|ModelInterface|null
{
return $this->_relation->count($this->model::className(), $this->value);
}
}
<?php
declare(strict_types=1);
namespace Database;
use Exception;
use Database\Traits\HasBase;
/**
* Class HasCount
* @package Database
*/
class HasCount extends HasBase
{
/**
* @param $name
* @param $arguments
* @return ActiveQuery
* @throws Exception
*/
public function __call($name, $arguments): mixed
{
if (method_exists($this, $name)) {
return call_user_func([$this, $name], ...$arguments);
}
return $this->_relation->getQuery($this->model::className())->$name(...$arguments);
}
/**
* @return array|null|ModelInterface
* @throws Exception
*/
public function get(): array|ModelInterface|null
{
return $this->_relation->count($this->model::className(), $this->value);
}
}