protected function initList($data) { foreach ($data as &$host) { $cHost = new \hmonitor\classes\Host(); $cHost->init($host); $host = $cHost; } return $data; }
protected function save($values) { $url = 'http://' . strtolower($values['host_name']); $result = classes\Result::success('Хост ' . $url . ' добавлен успешно'); $cHost = new \hmonitor\classes\Host(); $cHost->url = $url; $cHost->status = 1; $save_result = $cHost->save(); if (!$save_result) { $result = classes\Result::failure('Ошибка при сохранении в БД'); } return $result; }