Skip to content

Commit

Permalink
Merge pull request #88 from hughsaffar/master
Browse files Browse the repository at this point in the history
Add handle method in order to delegate to fire method for Laravel 5.5
  • Loading branch information
Torann authored Sep 19, 2017
2 parents 9e7bff7 + 1386eb9 commit b5d77ed
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/vendor
composer.phar
composer.lock
.DS_Store
.DS_Store
.idea/*
14 changes: 12 additions & 2 deletions src/Console/Clear.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@ class Clear extends Command
*/
protected $description = 'Clear GeoIP cached locations.';

/**
* Execute the console command for Laravel 5.5 and newer.
* @return void
*/
public function handle()
{
$this->fire();
}

/**
* Execute the console command.
* @return void
*/
public function fire()
{
Expand All @@ -40,7 +50,7 @@ public function fire()
protected function isSupported()
{
return empty(app('geoip')->config('cache_tags')) === false
&& in_array(config('cache.default'), ['file', 'database']) === false;
&& in_array(config('cache.default'), ['file', 'database']) === false;
}

/**
Expand All @@ -56,4 +66,4 @@ protected function performFlush()

$this->output->writeln("<info>complete</info>");
}
}
}
16 changes: 12 additions & 4 deletions src/Console/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ class Update extends Command
*/
protected $description = 'Update GeoIP database files to the latest version';

/**
* Execute the console command for Laravel 5.5 and newer.
* @return void
*/
public function handle()
{
$this->fire();
}

/**
* Execute the console command.
*
Expand All @@ -32,7 +41,7 @@ public function fire()

// Ensure the selected service supports updating
if (method_exists($service, 'update') === false) {
$this->info('The current service "' . get_class($service). '" does not support updating.');
$this->info('The current service "' . get_class($service) . '" does not support updating.');
return;
}

Expand All @@ -41,9 +50,8 @@ public function fire()
// Perform update
if ($result = $service->update()) {
$this->info($result);
}
else {
} else {
$this->error('Update failed!');
}
}
}
}

0 comments on commit b5d77ed

Please sign in to comment.