Skip to content

Commit

Permalink
Merge pull request #9 from ShibuyaKosuke/refactor
Browse files Browse the repository at this point in the history
wip
  • Loading branch information
ShibuyaKosuke authored Apr 29, 2022
2 parents 4a4881d + d624dd7 commit df4cc6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Imports/PostalCodeImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function registerEvents(): array
AfterImport::class => function (AfterImport $event) {
PostalCode::query()
->selectRaw('floor(official_code / 1000) as id, pref as name')
->groupByRaw('id, name')
->groupByRaw('floor(official_code / 1000), name')
->get(['id', 'name'])
->each(function ($prefecture) {
Prefecture::updateOrcreate([
Expand All @@ -78,7 +78,7 @@ public function registerEvents(): array
});
PostalCode::query()
->selectRaw('official_code as id, floor(official_code / 1000) as prefecture_id, city as name')
->groupByRaw('prefecture_id, id, name')
->groupByRaw('floor(official_code / 1000), official_code, city')
->get(['id', 'prefecture_id', 'name'])
->each(function ($city) {
City::updateOrCreate([
Expand Down

0 comments on commit df4cc6c

Please sign in to comment.