fix add nas
This commit is contained in:
@ -2,24 +2,24 @@
|
||||
|
||||
class Radius {
|
||||
|
||||
public function getTableNas(){
|
||||
public static function getTableNas(){
|
||||
return ORM::for_table('nas', 'radius');
|
||||
}
|
||||
|
||||
public function getTableCustomer(){
|
||||
public static function getTableCustomer(){
|
||||
return ORM::for_table('radcheck', 'radius');
|
||||
}
|
||||
|
||||
public function getTablePackage(){
|
||||
public static function getTablePackage(){
|
||||
return ORM::for_table('radgroupreply', 'radius');
|
||||
}
|
||||
|
||||
public function getTableUserPackage(){
|
||||
public static function getTableUserPackage(){
|
||||
return ORM::for_table('radusergroup', 'radius');
|
||||
}
|
||||
|
||||
public function addNas($name, $ip, $ports, $secret, $description = "",$type = 'other', $server= null, $community= null){
|
||||
$n = $this->getTableNas()->create();
|
||||
public static function addNas($name, $ip, $ports, $secret, $description = "",$type = 'other', $server= null, $community= null){
|
||||
$n = Radius::getTableNas()->create();
|
||||
$n->nasname = $ip;
|
||||
$n->shortname = $name;
|
||||
$n->type = $type;
|
||||
@ -31,8 +31,9 @@ class Radius {
|
||||
$n->save();
|
||||
return $n->id();
|
||||
}
|
||||
public function updateNas($id, $name, $ip, $ports, $secret, $description = "",$type = 'other', $server= null, $community= null){
|
||||
$n = $this->getTableNas()->find_one($id);
|
||||
|
||||
public static function updateNas($id, $name, $ip, $ports, $secret, $description = "",$type = 'other', $server= null, $community= null){
|
||||
$n = Radius::getTableNas()->find_one($id);
|
||||
if(empty($n)){
|
||||
return false;
|
||||
}
|
||||
@ -44,8 +45,7 @@ class Radius {
|
||||
$n->description = $description;
|
||||
$n->server = $server;
|
||||
$n->community = $community;
|
||||
$n->save();
|
||||
return true;
|
||||
return $n->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user