Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangjchandler committed Oct 4, 2023
1 parent 6283bfd commit ea2b755
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": {
"php": "^8.2",
"ext-json": "*",
"illuminate/console": "^10.0",
"illuminate/console": "*",
"illuminate/database": "^10.0",
"illuminate/events": "^10.0",
"illuminate/support": "^10.0",
Expand Down
27 changes: 27 additions & 0 deletions src/Commands/ClearCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Orbit\Commands;

use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;

class ClearCommand extends Command
{
protected $signature = 'orbit:clear {--force}';

protected $description = 'Clear Orbit\'s cache.';

public function handle()
{
if (! $this->option('force') && ! $this->confirm('Are you sure you want to clear Orbit\'s cache?')) {
return self::SUCCESS;
}

$fs = new Filesystem();
$fs->delete(config('orbit.paths.database'));

$this->info('Cache cleared.');

return self::SUCCESS;
}
}
5 changes: 4 additions & 1 deletion src/OrbitServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public function configurePackage(Package $package): void
})
->askToStarRepoOnGitHub('ryangjchandler/orbit');
})
->hasConfigFile();
->hasConfigFile()
->hasCommands([
Commands\ClearCommand::class,
]);
}

public function packageRegistered()
Expand Down

0 comments on commit ea2b755

Please sign in to comment.