Skip to content

Commit

Permalink
Merge pull request #47 from ryangjchandler/feature/command-helpers
Browse files Browse the repository at this point in the history
Feature/command helpers
  • Loading branch information
ryangjchandler authored Mar 29, 2021
2 parents eedcc67 + cf30928 commit b01f1d8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"illuminate/database": "^8.0",
"illuminate/events": "^8.0",
"illuminate/support": "^8.0",
"illuminate/console": "^8.0",
"spatie/yaml-front-matter": "^2.0",
"symfony/yaml": "^3.0 || ^4.0 || ^5.0",
"symplify/git-wrapper": "^9.2"
Expand Down Expand Up @@ -47,5 +48,8 @@
"scripts": {
"psalm": "vendor/bin/psalm",
"test": "vendor/bin/phpunit --colors=always"
},
"config": {
"sort-packages": true
}
}
32 changes: 32 additions & 0 deletions src/Commands/ClearCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Orbit\Commands;

use Illuminate\Console\Command;
use Orbit\Facades\Orbit;

class ClearCommand extends Command
{
protected $name = 'orbit:clear';

protected $descripition = 'Clear the Orbit database cache.';

public function handle()
{
if (Orbit::isTesting()) {
return 0;
}

$path = Orbit::getDatabasePath();

if (! file_exists($path)) {
return 0;
}

unlink($path);

$this->info('Succesfully cleared the Orbit cache.');

return 0;
}
}
4 changes: 4 additions & 0 deletions src/OrbitServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public function register()
public function boot()
{
if ($this->app->runningInConsole()) {
$this->commands([
Commands\ClearCommand::class,
]);

$this->publishes([
__DIR__.'/../config/orbit.php' => config_path('orbit.php'),
], 'orbit:config');
Expand Down

0 comments on commit b01f1d8

Please sign in to comment.