v.2.30
Добавлен расширенный отчет по реализации Добавлен монитор активности
This commit is contained in:
43
commands/POSTTerminals.php
Normal file
43
commands/POSTTerminals.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Component\Models\Terminal;
|
||||
use App\Console\Commands\HRCCommand;
|
||||
use App\Console\Commands\HRCCommandInterface;
|
||||
|
||||
class POSTTerminals extends HRCCommand implements HRCCommandInterface
|
||||
{
|
||||
protected $signature = 'postterminals';
|
||||
|
||||
public function command($input, $output = null)
|
||||
{
|
||||
|
||||
if (isset($input['method'])) {
|
||||
$method = $input['method'];
|
||||
if ($method == 'update') {
|
||||
if (isset($input['data'])) {
|
||||
$data = $input['data'];
|
||||
$data = json_decode(base64_decode(urldecode($data)), true);
|
||||
$terminals = Terminal::get();
|
||||
foreach ($terminals as $terminal) {
|
||||
if ($terminal['work_group'] == $data['work_group']) {
|
||||
$item = Terminal::find($terminal['id']);
|
||||
$item->name = $data['name'];
|
||||
$item->save();
|
||||
}
|
||||
}
|
||||
$terminals = Terminal::get();
|
||||
return [
|
||||
'status' => 'success',
|
||||
'terminals' => $terminals
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [
|
||||
'status' => 'fail',
|
||||
'error_message' => 'Проверьте введенные данные',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user