mirror of
https://github.com/anikeen-com/print-cli.git
synced 2026-03-15 06:36:08 +00:00
Add autowire
Add logs command Improve print jobs handling Improve installation/documentation
This commit is contained in:
44
app/Commands/Printers.php
Normal file
44
app/Commands/Printers.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user