Редактор карты зала
Электронные заказы
Отчет по удалениям
This commit is contained in:
miroman-afk
2022-09-22 16:34:02 +03:00
parent 1af2b267f5
commit dcd0e72d1f
43 changed files with 2481 additions and 727 deletions

51
commands/GETRoomMap.php Normal file
View File

@@ -0,0 +1,51 @@
<?php
namespace App\Commands;
use App\Component\Models\Places;
use App\Component\Models\Tables;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class GETRoomMap extends HRCCommand implements HRCCommandInterface {
protected $signature = 'getroommap';
public function command($input, $output = null) {
if (isset($input['type'])) {
$roommap = [];
if ($input['type'] == 'places') {
$places = Places::all();
return [
'status' => 'success',
'places' => $places,
];
}
if ($input['type'] == 'place' && isset($input['id'])) {
$place_name = Places::getName($input['id']);
$tables = Tables::where('place_id', $input['id'])->get();
return [
'status' => 'success',
'place_id' => $input['id'],
'place' => $place_name,
'tables' => $tables,
];
}
if ($input['type'] == 'full') {
$places = Places::all();
foreach ($places as $place) {
$tables = Tables::where('place_id', $place['id'])->get();
$roommap[] = array('place_id' => $place['id'], 'place_name' => $place['name'], 'tables' => $tables);
}
return [
'status' => 'success',
'roommap' => $roommap,
];
}
} else {
return [
'status' => 'success',
'message' => 'Ошибка данных запроса',
];
}
}
}