Add console configuration event (#1349)

* Add console configuration event

* Fix comment formatting
This commit is contained in:
Clark Winkelmann 2018-02-07 12:19:08 +01:00 committed by Toby Zerner
parent 419adb748b
commit 636e965873
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Console\Event;
use Flarum\Foundation\Application;
use Symfony\Component\Console\Application as ConsoleApplication;
/**
* Configure the console application.
*
* This event is fired after the core commands are added to the application.
*/
class Configuring
{
/**
* @var Application
*/
public $app;
/**
* @var ConsoleApplication
*/
public $console;
/**
* @param Application $app
* @param ConsoleApplication $console
*/
public function __construct(Application $app, ConsoleApplication $console)
{
$this->app = $app;
$this->console = $console;
}
}

View File

@ -11,6 +11,7 @@
namespace Flarum\Console;
use Flarum\Console\Event\Configuring;
use Flarum\Database\Console\GenerateMigrationCommand;
use Flarum\Database\Console\MigrateCommand;
use Flarum\Foundation\Application;
@ -19,6 +20,7 @@ use Flarum\Foundation\Console\InfoCommand;
use Flarum\Foundation\Site;
use Flarum\Install\Console\InstallCommand;
use Flarum\Install\InstallServiceProvider;
use Illuminate\Contracts\Events\Dispatcher;
use Symfony\Component\Console\Application as ConsoleApplication;
class Server
@ -73,6 +75,9 @@ class Server
));
}
$events = $this->app->make(Dispatcher::class);
$events->fire(new Configuring($this->app, $console));
return $console;
}
}