/** * Execute the console command. * * @return mixed */ public function handle() { if (File::exists(Config::publishedMigrationRealpath())) { if (!$this->confirm('The migration file already exists, overwrite it? [Yes|no]')) { $this->line(''); return $this->info('Okay, no changes made to the file.'); } } $inputFile = file_get_contents(Config::localMigrationRealpath()); $outputFile = fopen(Config::publishedMigrationRealpath(), 'w'); if ($inputFile && $outputFile) { fwrite($outputFile, $inputFile); fclose($outputFile); } else { File::delete(Config::publishedSeederRealpath()); $this->line(''); return $this->error('There was an error creating the migration file, ' . 'check write permissions for database/migrations directory' . PHP_EOL . PHP_EOL . 'If you think this is a bug, please submit a bug report ' . 'at https://github.com/moharrum/laravel-geoip-world-cities/issues'); } $this->line(''); $this->info('Okay, migration file created successfully.'); }