@@ -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 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | $response = []; |
17 | 17 | |
18 | - Capsule::table( config('geography.nameTable.country') )->get()->each(function ($item) use ( &$response ) |
|
18 | + Capsule::table(config('geography.nameTable.country'))->get()->each(function($item) use (&$response) |
|
19 | 19 | { |
20 | 20 | $body = file_get_contents('https://api.vk.com/method/database.getRegions?v=5.5&count=1000&country_id=' . $item->id . |
21 | 21 | '&access_token=' . config('geography.access_token')); |