Files
kiri-core/Database/HasCount.php
T
2020-10-29 18:17:25 +08:00

37 lines
559 B
PHP

<?php
declare(strict_types=1);
namespace Database;
use Exception;
/**
* Class HasCount
* @package Database
*/
class HasCount extends HasBase
{
/**
* @param $name
* @param $arguments
* @return $this
* @throws Exception
*/
public function __call($name, $arguments)
{
$this->_relation->getQuery($this->model::className())->$name(...$arguments);
return $this;
}
/**
* @return array|null|ActiveRecord
* @throws Exception
*/
public function get()
{
return $this->_relation->count($this->model::className(), $this->value);
}
}