static function findLocation($domainName, $deviceName) { $dev = self::find()->where(['domain' => $domainName, 'node' => $deviceName])->asArray()->one(); if (!$dev) { $dom = Domain::find()->where(['name' => $domainName])->asArray()->one(); return $dom; } return $dev; }
public function edit($id) { $param['pageNo'] = 1; $result = DomainModel::find($id); $param['domain'] = $result; $param['language'] = LanguageModel::all(); $param['template'] = TemplateModel::all(); return View::make('domains.edit')->with($param); }
/** * Delete a record * * @param $id * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function destroy($id) { $domain = Domain::find($id); $request = new Request(); try { $domain->delete(); $request->session()->flash('success', 'Domain ' . $id . ' has been created!'); } catch (Exception $e) { $request->session()->flash('danger', 'Domain ' . $id . ' was not created, please try again.'); } return view('domains.index'); }
public function destroy($id) { $domain = Domain::find($id); if ($domain = null) { return response()->json(['error' => 'domain_does_not_existe'], 400); } $domain_id = $id; $zones = Zone::where('domain_id', '=', $domain_id)->delete(); $records = Record::where('domain_id', '=', $domain_id)->delete(); $domain = Domain::where('id', '=', $id)->delete(); return response()->json(['success'], 200); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Domain::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); // if (!$this->validate()) { // // uncomment the following line if you do not want to return any records when validation fails // // $query->where('0=1'); // return $dataProvider; // } $query->andFilterWhere(['domain_id' => $this->domain_id, 'notify_when_down' => $this->notify_when_down, 'notify_when_up' => $this->notify_when_up, 'account_id' => $this->account_id, 'date_added' => $this->date_added, 'date_updated' => $this->date_updated, 'watch_mx' => $this->watch_mx, 'watch_dns' => $this->watch_dns, 'watch_ip' => $this->watch_ip]); $query->andFilterWhere(['like', 'domain', $this->domain])->andFilterWhere(['like', 'added_ip', $this->added_ip])->andFilterWhere(['like', 'updated_ip', $this->updated_ip]); return $dataProvider; }
function parseDomains() { $this->xpath->registerNamespace('x', "http://schemas.ogf.org/nml/2013/05/base#"); $netNodes = $this->xpath->query("//x:Topology"); $i = 0; if ($netNodes) { foreach ($netNodes as $netNode) { $netId = $netNode->getAttribute('id'); $id = explode(":", $netId); // 0 1 2 3 4 5 // urn:ogf:network:cipo.rnp.br:2014::POA $domainName = $id[3]; $geo = Domain::find()->where(['name' => $domainName])->asArray()->one(); if (!$geo) { $geo = $this->getLocation($domainName); Domain::createIfNew($domainName, $geo['lat'], $geo['lng'], $geo['address']); $i++; } /*$location = $netNode->appendChild($this->xml->createElement('location')); $lat = $location->appendChild($this->xml->createElement('latitude')); $lat->appendChild($this->xml->createTextNode($geo['lat'])); $lng = $location->appendChild($this->xml->createElement('longitude')); $lng->appendChild($this->xml->createTextNode($geo['lng'])); $address = $location->appendChild($this->xml->createElement('address')); $address->appendChild($this->xml->createTextNode(urlencode($geo['address'])));*/ $this->parsePorts($netNode, $netId); } if ($i > 3) { $i = 0; sleep(1); } } }