diff --git a/app/Console/Commands/UpdatePlacesURLs.php b/app/Console/Commands/UpdatePlacesURLs.php new file mode 100644 index 00000000..97a28f97 --- /dev/null +++ b/app/Console/Commands/UpdatePlacesURLs.php @@ -0,0 +1,58 @@ +places = Place::all(); + } + + /** + * Execute the console command. + * + * @return mixed + */ + public function handle() + { + foreach ($this->places as $place) { + if ($place->foursqaure !== null) { + $place->external_urls = $place->foursquare; + } + } + + $this->info('All Places have had their external URLs values updated to the new structure.'); + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 0a0aa08d..ebbc97f5 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -17,6 +17,7 @@ class Kernel extends ConsoleKernel Commands\ParseCachedWebMentions::class, Commands\ReDownloadWebMentions::class, Commands\GenerateToken::class, + Commands\UpdatePlacesURLs::class, ]; /** diff --git a/changelog.md b/changelog.md index 8a1cd4d1..a83e59ba 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## Version {next} - Transition to using a JSON column for external urls of places + - Add a command to update external url structure of places ## Version 0.5.19 (2017-06-27) - Fix error in App\\WebMention.php