Skip to content

Commit

Permalink
command handle/fire for compatibility for older laravel versions
Browse files Browse the repository at this point in the history
  • Loading branch information
webpatser committed May 16, 2018
1 parent cf29cdb commit 860e1ab
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/commands/MigrationCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

namespace Webpatser\Countries;

Expand Down Expand Up @@ -31,13 +31,13 @@ public function __construct()
$app = app();
$app['view']->addNamespace('countries',substr(__DIR__,0,-8).'views');
}

/**
* Execute the console command.
*
* @return void
*/
public function fire()
public function handle()
{
$this->line('');
$this->info('The migration process will create a migration file and a seeder for the countries list');
Expand All @@ -60,7 +60,7 @@ public function fire()
$this->info( "Migration successfully created!" );
}
else{
$this->error(
$this->error(
"Coudn't create migration.\n Check the write permissions".
" within the app/database/migrations directory."
);
Expand Down Expand Up @@ -97,7 +97,7 @@ protected function createMigration()

$seconds = 0;

foreach ($migrationFiles as $migrationFile => $outputFile) {
foreach ($migrationFiles as $migrationFile => $outputFile) {
if (sizeof(glob($migrationFile)) == 0) {
$migrationFile = str_replace('*', date('Y_m_d_His', strtotime('+' . $seconds . ' seconds')), $migrationFile);

Expand Down Expand Up @@ -131,5 +131,12 @@ protected function createMigration()

return true;
}


/**
* BC for older laravel versions
*/
public function fire()
{
$this->handle();
}
}

0 comments on commit 860e1ab

Please sign in to comment.