Exemplo n.º 1
0
 /**
  * Create product view by data array
  *
  * @param $data
  * @return tagModel
  */
 public function createItem($data)
 {
     $trackingSearch = new trackingSearchModel();
     foreach ($data as $key => $value) {
         $trackingSearch->{$key} = $value;
     }
     $trackingSearch->save();
     return $trackingSearch;
 }
Exemplo n.º 2
0
 public function reportDetailTableTrackingSearch($request)
 {
     $trackingSearchModel = new trackingSearchModel();
     $datatables = new DataTables();
     //        $viewHelper = new ViewGenerateHelper();
     $columns = array(array('db' => 'tracking_search.id AS tracking_search_id', 'dt' => 0), array('db' => 'tracking_search.keyword', 'dt' => 1), array('db' => 'users.name', 'dt' => 2), array('db' => 'tracking_search.ip', 'dt' => 3), array('db' => 'tracking_search.type', 'dt' => 4), array('db' => 'tracking_search.created_at', 'dt' => 5));
     $return = $trackingSearchModel->reportDetailTableTrackingSearch($request, $columns);
     $return['data'] = $datatables::data_output($columns, $return['data']);
     foreach ($return['data'] as &$item) {
         $location = json_decode(file_get_contents('http://freegeoip.net/json/' . $item[3]));
         $item[3] = $item[3] . '<br><b>' . $location->region_name . ', ' . $location->city;
     }
     return $return;
 }