45 lines
1013 B
PHP
45 lines
1013 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Settings\GeneralSettings;
|
|
use Illuminate\Console\Command;
|
|
|
|
class GetPrinterSetting extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'setting:get-printer';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Get the raw value of the \'selected_printer\' setting.';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle(GeneralSettings $settings)
|
|
{
|
|
$value = $settings->selected_printer === '__custom__'
|
|
? $settings->custom_printer_address
|
|
: $settings->selected_printer;
|
|
|
|
if ($value) {
|
|
$this->info('Raw value of \'selected_printer\' setting:');
|
|
$this->info($value);
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
|
|
$this->info('\'selected_printer\' setting not found.');
|
|
|
|
return Command::FAILURE;
|
|
}
|
|
}
|