mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Allow DI in console command constructor (#4920)
Allow DI in console command constructor
This commit is contained in:
parent
27c632034a
commit
83c63f93b4
@ -279,17 +279,13 @@ class PluginBase extends ServiceProviderBase
|
||||
* Registers a new console (artisan) command
|
||||
*
|
||||
* @param string $key The command name
|
||||
* @param string $class The command class
|
||||
* @param string|\Closure $command The command class or closure
|
||||
* @return void
|
||||
*/
|
||||
public function registerConsoleCommand($key, $class)
|
||||
public function registerConsoleCommand($key, $command)
|
||||
{
|
||||
$key = 'command.'.$key;
|
||||
|
||||
$this->app->singleton($key, function ($app) use ($class) {
|
||||
return new $class;
|
||||
});
|
||||
|
||||
$this->app->singleton($key, $command);
|
||||
$this->commands($key);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user