1. Редактор карты зала.
This commit is contained in:
miroman-afk
2022-10-27 15:48:02 +03:00
parent 0e5f2002b1
commit 4d3ad7727d
21 changed files with 625 additions and 192 deletions

View File

@@ -7,11 +7,13 @@ use App\Component\Models\Tables;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class GETRoomMap extends HRCCommand implements HRCCommandInterface {
protected $signature = 'getroommap';
class GETRoomMap extends HRCCommand implements HRCCommandInterface
{
protected $signature = 'getroommap';
public function command($input, $output = null) {
if (isset($input['type'])) {
public function command($input, $output = null)
{
if (isset($input['type'])) {
$roommap = [];
if ($input['type'] == 'places') {
$places = Places::all();
@@ -22,7 +24,8 @@ class GETRoomMap extends HRCCommand implements HRCCommandInterface {
}
if ($input['type'] == 'place' && isset($input['id'])) {
$place_name = Places::getName($input['id']);
$tables = Tables::where('place_id', $input['id'])->get();
$tables = Tables::where('place_id', $input['id'])
->get();
return [
'status' => 'success',
'place_id' => $input['id'],
@@ -33,19 +36,24 @@ class GETRoomMap extends HRCCommand implements HRCCommandInterface {
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);
$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' => 'Ошибка данных запроса',
];
}
}
} else {
return [
'status' => 'success',
'message' => 'Ошибка данных запроса',
];
}
}
}