mirror of
https://github.com/flarum/core.git
synced 2025-08-02 14:37:49 +02:00
Improved the console configuring event to support any type of console command to be added
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
namespace Flarum\Console\Event;
|
namespace Flarum\Console\Event;
|
||||||
|
|
||||||
use Flarum\Foundation\Application;
|
use Flarum\Foundation\Application;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
use Symfony\Component\Console\Application as ConsoleApplication;
|
use Symfony\Component\Console\Application as ConsoleApplication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,4 +41,22 @@ class Configuring
|
|||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
$this->console = $console;
|
$this->console = $console;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a console command to the flarum binary.
|
||||||
|
*
|
||||||
|
* @param Command|string $command
|
||||||
|
*/
|
||||||
|
public function addCommand($command)
|
||||||
|
{
|
||||||
|
if (is_string($command)) {
|
||||||
|
$command = $this->app->make($command);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($command instanceof Command) {
|
||||||
|
$command->setLaravel($this->app);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->console->add($command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user