Wrote this simple test command but does not seem to work:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Config;
use Symfony\Component\Console\Input\InputArgument;
class ConfigGetCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $name = 'config:get';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Outputs value of a config key';
/**
* Register command arguments
* @return array
*/
protected function getArguments()
{
return [
['key', InputArgument::OPTIONAL, 'The config key that should be returned.'],
];
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$key = $this->argument('key') ?: 'app.key';
$key = strval($key);
$this->comment(PHP_EOL . $key . ' = ' . Config::get($key, null) . PHP_EOL);
}
}