Files
print-cli/app/Commands/Printers.php
René Preuß 621b6cb5c0 Add autowire
Add logs command
Improve print jobs handling
Improve installation/documentation
2025-07-29 22:16:32 +02:00

45 lines
895 B
PHP

<?php
namespace App\Commands;
use App\Support\PrinterManager;
use LaravelZero\Framework\Commands\Command;
class Printers extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'printers';
/**
* The console command description.
*
* @var string
*/
protected $description = 'List all printers';
/**
* Execute the console command.
*/
public function handle(PrinterManager $printers): int
{
$printers = $printers->getList();
if ($printers->isEmpty()) {
$this->error('We could not find any printers! Please register them first in CUPS.');
return 1;
}
$this->info('Printer:');
foreach ($printers as $printer) {
$this->info($printer->getName());
}
return 0;
}
}