| Server IP : 195.130.67.5 / Your IP : 216.73.217.127 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/prosvasi/wp-content/plugins/wp-statistics/src/Models/ |
Upload File : |
<?php
namespace WP_Statistics\Models;
use WP_Statistics\Abstracts\BaseModel;
use WP_Statistics\Utils\Query;
class ExclusionsModel extends BaseModel
{
public function countExclusions($args = [])
{
$args = $this->parseArgs($args, [
'date' => '',
'reason' => ''
]);
$result = Query::select(['SUM(count) as count'])
->from('exclusions')
->where('reason', '=', $args['reason'])
->whereDate('date', $args['date'])
->orderBy('date')
->getVar();
return $result ?? 0;
}
public function getExclusions($args = [])
{
$args = $this->parseArgs($args, [
'date' => '',
'reason' => '',
'exclusion_id' => '',
'per_page' => '',
'page' => 1,
'order_by' => 'count',
'order' => 'DESC',
'group_by' => 'reason',
]);
$result = Query::select([
'reason',
'date',
'SUM(count) as count'
])
->from('exclusions')
->where('reason', '=', $args['reason'])
->where('id', '=', $args['exclusion_id'])
->whereDate('date', $args['date'])
->perPage($args['page'], $args['per_page'])
->groupBy($args['group_by'])
->orderBy($args['order_by'], $args['order'])
->getAll();
return $result;
}
}