SetSettingCommand.php
SetSettingCommand.php
php
namespace App\Console\Commands;
use Exception;
use Illuminate\Console\Command;
/**
* The console command description.
*
* @var string
*/
protected $description = 'Set value of a setting key.';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$class = $this->argument('class');
$key = $this->argument('key');
$value = $this->argument('value');
try {
$settings_class = "App\\Settings\\$class";
$settings = new $settings_class();
$settings->$key = $value;
$settings->save();
return Command::SUCCESS;
}
}