@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | { |
| 10 | 10 | public function execute() |
| 11 | 11 | { |
| 12 | - Capsule::schema()->create('country', function ($table) { |
|
| 12 | + Capsule::schema()->create('country', function($table) { |
|
| 13 | 13 | $table->increments('id'); |
| 14 | 14 | $table->string('title', 100); |
| 15 | 15 | $table->string('code')->nullable()->comments('unique value'); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function check(callable $callback) |
| 22 | 22 | { |
| 23 | - if ( Capsule::schema()->hasTable('country') === false ) |
|
| 23 | + if (Capsule::schema()->hasTable('country') === false) |
|
| 24 | 24 | { |
| 25 | 25 | call_user_func($callback, $this); |
| 26 | 26 | } |
@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | public function run() |
| 26 | 26 | { |
| 27 | 27 | ini_set('memory_limit', '256M'); |
| 28 | - Capsule::transaction(function () { |
|
| 28 | + Capsule::transaction(function() { |
|
| 29 | 29 | $response = []; |
| 30 | 30 | $offset = 0; |
| 31 | 31 | $arrCities = []; |
| 32 | - $regions = Capsule::table(config('geography.nameTable.regions'))->get()->pluck('id', 'title')->toArray(); |
|
| 33 | - $country = Capsule::table(config('geography.nameTable.country'))->get(); |
|
| 32 | + $regions = Capsule::table(config('geography.nameTable.regions'))->get()->pluck('id', 'title')->toArray(); |
|
| 33 | + $country = Capsule::table(config('geography.nameTable.country'))->get(); |
|
| 34 | 34 | |
| 35 | 35 | foreach ($country as $concreteCountry) |
| 36 | 36 | { |
| 37 | 37 | do { |
| 38 | - $body = file_get_contents( |
|
| 38 | + $body = file_get_contents( |
|
| 39 | 39 | 'https://api.vk.com/method/database.getCities?v=5.5&country_id=' |
| 40 | 40 | . $concreteCountry->id |
| 41 | 41 | . '&need_all=1&count=1000&offset=' |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | ]; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - $response = array_merge($response, $responseArray['response']['items']); |
|
| 56 | + $response = array_merge($response, $responseArray['response']['items']); |
|
| 57 | 57 | $offset += 1000; |
| 58 | 58 | |
| 59 | 59 | Capsule::table('cities')->insert($arrCities); |
| 60 | 60 | $arrCities = []; |
| 61 | - } while( ( count($responseArray['response']['items']) > 0) ); |
|
| 61 | + } while ((count($responseArray['response']['items']) > 0)); |
|
| 62 | 62 | } |
| 63 | 63 | }); |
| 64 | 64 | } |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function run() |
| 15 | 15 | { |
| 16 | - $body = file_get_contents('https://api.vk.com/method/database.getCountries?v=5.5&need_all=1&count=1000&lang='. |
|
| 17 | - config('geography.locale') . '&code=' . config('geography.country') . '&access_token=' . |
|
| 18 | - config('geography.access_token')); |
|
| 19 | - $response = json_decode($body, true); |
|
| 16 | + $body = file_get_contents('https://api.vk.com/method/database.getCountries?v=5.5&need_all=1&count=1000&lang='. |
|
| 17 | + config('geography.locale') . '&code=' . config('geography.country') . '&access_token=' . |
|
| 18 | + config('geography.access_token')); |
|
| 19 | + $response = json_decode($body, true); |
|
| 20 | 20 | |
| 21 | - Capsule::table( config('geography.nameTable.country') )->insert( $response['response']['items'] ); |
|
| 21 | + Capsule::table( config('geography.nameTable.country') )->insert( $response['response']['items'] ); |
|
| 22 | 22 | } |
| 23 | 23 | } |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function run() |
| 15 | 15 | { |
| 16 | - $body = file_get_contents('https://api.vk.com/method/database.getCountries?v=5.5&need_all=1&count=1000&lang='. |
|
| 17 | - config('geography.locale') . '&code=' . config('geography.country') . '&access_token=' . |
|
| 16 | + $body = file_get_contents('https://api.vk.com/method/database.getCountries?v=5.5&need_all=1&count=1000&lang=' . |
|
| 17 | + config('geography.locale') . '&code=' . config('geography.country') . '&access_token=' . |
|
| 18 | 18 | config('geography.access_token')); |
| 19 | - $response = json_decode($body, true); |
|
| 19 | + $response = json_decode($body, true); |
|
| 20 | 20 | |
| 21 | - Capsule::table( config('geography.nameTable.country') )->insert( $response['response']['items'] ); |
|
| 21 | + Capsule::table(config('geography.nameTable.country'))->insert($response['response']['items']); |
|
| 22 | 22 | } |
| 23 | 23 | } |