Update api requests
This commit is contained in:
35
commands/Equipment.php
Normal file
35
commands/Equipment.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Printer;
|
||||
use App\Component\Models\PrinterSettings;
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class Equipment extends HRCCommand implements HRCCommandInterface {
|
||||
protected $signature = 'getequipment';
|
||||
|
||||
public function command($input, $output = null) {
|
||||
$terminals = Terminal::select('work_code', 'work_group')
|
||||
->where('key', '=', $input['terminal'])
|
||||
->get();
|
||||
foreach ($terminals as $terminal) {
|
||||
$terminal_data = array('work_code' => $terminal['work_code'], 'work_group' => $terminal['work_group']);
|
||||
}
|
||||
$printer_groups = Printer::select('code', 'name')
|
||||
->where('is_history', '=', 0)
|
||||
->get();
|
||||
$printers = PrinterSettings::select('name', 'id', 'ip', 'com_port', 'type', 'speed', 'printer_group', 'template', 'size', 'driver', 'codepage', 'more')
|
||||
->where('workgroup', '=', $terminal_data['work_group'])
|
||||
->where('workcode', '=', $terminal_data['work_code'])
|
||||
->get();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'terminal_data' => $terminal_data,
|
||||
'printer_groups' => $printer_groups,
|
||||
'printers' => $printers,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user