needlogin=true; $me = new User(); $me->loadMe(); $this->me = $me; $this->layout()->set("me",$me); if(!$me->is(["Admin"])) { $this->redirect("Dashboard"); } } protected function indexAction() { $this->layout()->setTemplate("Admin/Index"); } protected function createNetworkAddressForNetowner() { $i = 0; foreach(NetworkModel::getAll() as $network) { $netaddress = NetworkAddressModel::getFirst(["network_id" => $network->id, "address_id" => $network->owner_id, "addresstype" => "netowner"]); if(!$netaddress) { $netaddress = NetworkAddressModel::create([ 'network_id' => $network->id, 'address_id' => $network->owner_id, 'type' => "netowner" ]); $netaddress->save(); $i++; } } $this->layout()->setFlash("$i NetworkAddress Objekte angelegt.", "success"); $this->redirect("Admin"); } }