v.2.22
Редактор карты зала Электронные заказы Отчет по удалениям
This commit is contained in:
51
commands/GETRoomMap.php
Normal file
51
commands/GETRoomMap.php
Normal 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' => 'Ошибка данных запроса',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user