<?php

defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );

class Statistics_model extends MY_Model {

  public function bussiness_type() 
  {
    $data['select'] = 'COUNT(*) as total, bussiness_type.id, bussiness_type.name as name';
    $data['where'] = array( 'role' => 3 );
    $data['table'] = 'users';
    $data['join'] = ['table' => 'bussiness_type', 'on' => 'bussiness_type.id = users.bussiness_type'];
    $data['group_by'] = 'bussiness_type';

    return $this->get($data);
  }

  public function gender()
  {
    $data['select'] = 'users.gender as name, COUNT(users.gender) as count';
    $data['where'] = array( 'role' => 3 );
    $data['table'] = 'users';
    $data['group_by'] = 'gender';

    return $this->get($data);
  }

}