public function count()
    {
        $this->db()->table($this->table)->groupBy($this->table . '.' . $this->primaryKey);
        $this->hasOne()->belongsToMany();
        $count = $this->db()->count($this->primaryKey);
        return $count;
    }