mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
Little Tweeks
This commit is contained in:
1 parent
946a93a23b
commit
ab92a58289
5 files changed
+37
-30
No files matched your search
@@ -33,13 +33,16 @@ class DeviceManager{
|
||||
WHERE devices.approved != ? ORDER BY $sort $sortType", Array(2));
|
||||
}
|
||||
|
||||
public static function create ($name, $token) {
|
||||
public static function create ($name, $token, $type = "") {
|
||||
$defaultRoom = RoomManager::getDefaultRoomId();
|
||||
$device = array (
|
||||
'name' => $name,
|
||||
'token' => $token,
|
||||
'room_id' => $defaultRoom,
|
||||
);
|
||||
if (!empty($type)) {
|
||||
$device['type'] = $type;
|
||||
}
|
||||
try {
|
||||
Db::add ('devices', $device);
|
||||
return Db::loadOne("SELECT device_id FROM devices WHERE token = ?", array($token))['device_id'];
|
||||
|
||||
Reference in new issue
Block a user