%PDF-1.4
Directory : /var/www/vhosts/lautnusantara.com/httpdocs/web/app/Models/ |
<?php namespace App\Models; use CodeIgniter\Model; class Wa_Model extends Model { public function save_hits($data) { $hits = $this->db->table('ssn_wa_hits')->insert($data); } public function update_hits($hits2) { $hits = $this->db->table('ssn_perusahaan')->update($hits2); } public function get_wa_perbulan($thn, $bln) { $builder = $this->db->table('ssn_wa_hits'); $builder->select('DAYOFWEEK(date_format(`created`,"%Y%m%d")) as nhari ,date_format(`created`,"%Y%m%d") as tgl ,date_format(`created`,"%d") as ntgl ,date_format(`created`,"%M") as bln ,WEEK(`created`) as nweek ,sum(hits) as jml '); $builder->where('ssn_wa_hits.active', '1'); $builder->where('ssn_wa_hits.trash', '0'); $builder->where('year(ssn_wa_hits.created)', $thn); $builder->where('month(ssn_wa_hits.created)', $bln); $builder->GroupBy('date_format(ssn_wa_hits.created,"%Y%m%d")'); $result = $builder->get(); return $result; } public function get_wa_pertahun($thn, $bln) { $builder = $this->db->table('ssn_wa_hits'); $builder->select('DAYOFWEEK(date_format(`created`,"%Y%m")) as nhari ,date_format(`created`,"%Y%m") as tgl ,date_format(`created`,"%m") as ntgl ,date_format(`created`,"%M") as bln ,sum(hits) as jml '); $builder->where('ssn_wa_hits.active', '1'); $builder->where('ssn_wa_hits.trash', '0'); $builder->where('year(ssn_wa_hits.created)', $thn); $builder->GroupBy('date_format(ssn_wa_hits.created,"%Y%m")'); $result = $builder->get(); return $result; } } ?>