request->post('inventoryNum'); $ip = Yii::$app->request->post('characteristic'); $storageId = (int)Yii::$app->request->post('storage'); $desc = Yii::$app->request->post('desc'); $tmc = Tmc::findOne(['inventory_num' => $inventoryNum]); if (!$tmc) { die('Устройство не найдено'); } $storage = Storage::findOne($storageId); if (!$tmc) { die('Хранилище не найдено'); } $tmc->storage = $storage->id; $tmc->ip = $ip; $tmc->desc = $desc; $tmc->save(); $storage->tmc = $tmc->id; $storage->save(); Yii::$app->response->redirect(Url::to($_SERVER['HTTP_REFERER']))->send();