mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 09:00:55 +08:00
Add console configuration event (#1349)
* Add console configuration event * Fix comment formatting
This commit is contained in:
parent
419adb748b
commit
636e965873
43
src/Console/Event/Configuring.php
Normal file
43
src/Console/Event/Configuring.php
Normal 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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user