Есть код
protected function redeemed_codes() {
$total = ['discount_codes' => 0, 'redeemable_codes' => 0];
$chart = [];
$result = database()->query("SELECT `type`, COUNT(`type`) AS `total`, DATE_FORMAT(`datetime`, '{$this->datetime['query_date_format']}') AS...