/** * Count records of model. * * @param string $alias Optional alias of count result * * @return int */ public function count($alias = null) { if ($this->controller && $this->controller->hasMethod('count')) { return $this->controller->count($this, $alias); } throw $this->exception('The controller doesn\'t support count', 'NotImplemented')->addMoreInfo('controller', $this->controller ? $this->controller->short_name : 'none'); }