public function statNumbers($data) { $datemonth = date('M Y', time()); $firstday = Carbon::parse('first day of ' . $datemonth); $lastday = Carbon::parse('last day of ' . $datemonth)->addHours(23)->addMinutes(59)->addSeconds(59); $qval = array('$gte' => new MongoDate(strtotime($firstday->toDateTimeString())), '$lte' => new MongoDate(strtotime($lastday->toDateTimeString()))); $qc = array(); $qc['adId'] = $data['_id']; $qc['clickedAt'] = $qval; $qv = array(); $qv['adId'] = $data['_id']; $qv['viewedAt'] = $qval; $clicks = Clicklog::whereRaw($qc)->count(); $views = Viewlog::whereRaw($qv)->count(); return $clicks . ' clicks<br />' . $views . ' views'; }
public static function ExtractHotspot($selection = true) { $category = Viewlog::distinct('spot')->get()->toArray(); if ($selection) { $cats = array('' => 'All'); } else { $cats = array(); } //print_r($category); foreach ($category as $cat) { $cats[$cat[0]] = $cat[0]; } return $cats; }