Skip to content

Commit

Permalink
Merge pull request #1 from jewdore/master
Browse files Browse the repository at this point in the history
fixed run command
  • Loading branch information
wgqi1126 authored Dec 25, 2018
2 parents 110b0ab + 87e6332 commit 94f1ede
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<?php

namespace Wgqi1126\LaravelTools\Console\Commands\Dev;
namespace Wgqi1126\LaravelTools\Console\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

abstract class BaseDevCommand extends Command
abstract class BaseLocalCommand extends Command
{
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!app()->isLocal()) {
$this->error(__('Dev command must run on dev env'));
die(2);
if (!$this->confirm(__('Are you sure run this command in a non-local environment?'))) {
die(2);
}
}
return parent::execute($input, $output);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace Wgqi1126\LaravelTools\Console\Commands\Dev;
namespace Wgqi1126\LaravelTools\Console\Commands;

class ResetDb extends BaseDevCommand
class ResetDb extends BaseLocalCommand
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ltools:dev:reset-db';
protected $signature = 'ltools:reset-db';

/**
* The console command description.
Expand Down
10 changes: 10 additions & 0 deletions src/Providers/LaravelToolsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,14 @@ public function register()
{
$this->commands($this->commands);
}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['ltools:reset-db'];
}
}

0 comments on commit 94f1ede

Please sign in to comment.