Skip to content

Commit

Permalink
Minor Update
Browse files Browse the repository at this point in the history
  • Loading branch information
irfaardy committed Feb 21, 2020
1 parent bf4259b commit 5c682d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Caching/DBImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private static function extractor($result,$type){
$where = ['province_id' => $r->province_id];

} elseif($type == 'city'){
$fill = ['city_id'=>$r->city_id,'province_id'=>$r->province_id,'province' => $r->province,'type'=>$r->type,'city_name'=>$r->city_name,'postal_code'=>$r->postal_code];
$fill = ['cixty_id'=>$r->city_id,'province_id'=>$r->province_id,'province' => $r->province,'type'=>$r->type,'city_name'=>$r->city_name,'postal_code'=>$r->postal_code];
$where = ['city_id' => $r->city_id];
}
if(DB::table(self::$table_DB)->where($where)->count() ==0){
Expand All @@ -31,9 +31,9 @@ private static function extractor($result,$type){
}
}
$count = DB::table(self::$table_DB)->count();
echo "Caching Success, ".$count." row(s) affected.";
echo "Cache has been created, ".$count." row(s) affected.";
} catch(\Exception $e){
echo "Can't creating cache. Error : ".$e;
echo "\033[91mCan't creating cache. Error\033[0m : ".$e;
}

}
Expand Down
6 changes: 4 additions & 2 deletions src/Ongkir/Func/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ private static function setup_option(){

}
protected static function cacheProvince(){
echo "Getting data from RajaOngkir...".PHP_EOL;
self::setup_option();
echo "Retrieving data from \033[96m".self::$url."...\033[0m".PHP_EOL;
CacheCurl::caching(self::get_province())->province();
}
protected static function cacheCity(){
echo "Getting data from RajaOngkir...".PHP_EOL;
self::setup_option();
echo "Retrieving data from\033[96m ".self::$url."...\033[0m".PHP_EOL;
CacheCurl::caching(self::get_city())->city();
}
protected static function get_province($arr = null){
Expand Down

0 comments on commit 5c682d0

Please sign in to comment.