Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/Illuminate/Foundation/Console/ConfigMakeCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Illuminate\Foundation\Console;

use Illuminate\Console\GeneratorCommand;

class ConfigMakeCommand extends GeneratorCommand
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'make:config';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a new config file';

public function handle()
{
$path = config_path().'/'.$this->getNameInput().'.php';
$stub = $this->files->get($this->getStub());

$this->files->put($path, $stub);
$this->info($this->getNameInput().' config created successfully.');
}

/**
* Get the stub file for the generator.
*
* @return string
*/
protected function getStub()
{
return __DIR__.'/stubs/config.stub';
}
}
5 changes: 5 additions & 0 deletions src/Illuminate/Foundation/Console/stubs/config.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
//
];
14 changes: 14 additions & 0 deletions src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Illuminate\Foundation\Console\ClearCompiledCommand;
use Illuminate\Foundation\Console\ConfigCacheCommand;
use Illuminate\Foundation\Console\ConfigClearCommand;
use Illuminate\Foundation\Console\ConfigMakeCommand;
use Illuminate\Foundation\Console\ConsoleMakeCommand;
use Illuminate\Foundation\Console\DownCommand;
use Illuminate\Foundation\Console\EnvironmentCommand;
Expand Down Expand Up @@ -119,6 +120,7 @@ class ArtisanServiceProvider extends ServiceProvider implements DeferrableProvid
protected $devCommands = [
'CacheTable' => 'command.cache.table',
'ChannelMake' => 'command.channel.make',
'ConfigMake' => 'command.config.make',
'ConsoleMake' => 'command.console.make',
'ControllerMake' => 'command.controller.make',
'EventGenerate' => 'command.event.generate',
Expand Down Expand Up @@ -270,6 +272,18 @@ protected function registerConfigClearCommand()
});
}

/**
* Register the command.
*
* @return void
*/
protected function registerConfigMakeCommand()
{
$this->app->singleton('command.config.make', function ($app) {
return new ConfigMakeCommand($app['files']);
});
}

/**
* Register the command.
*
Expand Down